Powered By Blogger

Apa kabara' ?

"Banyak Jalan Menuju Tuhan Sebanyak Nafas Para Pencarinya Tetapi Jalan Yang Paling Dekat Ke Tuhan Yaitu Menyayangi Sesama Manusia"

Karaeng Bombong

Karaeng Bombong

Senin, Desember 15, 2008

Jeni Servlet Pertemuan Kedua Desaing Web

Ini salah satu contoh yang kami kerjakan pada saat pertemuan kedua bersama Pak Resha :

/*
* Servletpertamaku.java
*
* Created on December 10, 2008, 10:12 AM
*/

package jeniservlet;

import java.io.*;
import java.net.*;

import javax.servlet.*;
import javax.servlet.http.*;

/**
*
* @author Komdat
* @version
*/
public class Servletpertamaku extends HttpServlet {

/** Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

out.println("");
out.println("");
out.println("Servlet Servletpertamaku");
out.println("");
out.println("");
out.println("

Servlet Servletpertamaku at " + request.getContextPath () + "

");
out.println("");
out.println("");

out.close();
}

//
/** Handles the HTTP GET method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/** Handles the HTTP POST method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
//

}