Java Reference
In-Depth Information
protected void
doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException
{
doBoth(request, response);
} // doGet
/**
* Handles the HTTP POST method.
* @param request servlet request
* @param response servlet response
*/
protected void
doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException
{
doBoth(request, response);
} // doPost
/**
* Requests for both HTTP GET and POST methods come here,
* because we're not doing anything different
* between the two request types. This way we need only one
* version of the code that does the real work.
* @param request servlet request
* @param response servlet response
*/
protected void
doBoth(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException
{
java.io.PrintWriter out = response.getWriter();
response.setContentType("text/html");
/* output our page of html */
out.println("<html>");
out.println("<head>");
out.println("<title>A Java Servlet</title>");
out.println("</head>");
out.println("<body>");
out.println("Hello, world.");
out.println("</body>");
out.println("</html>");
out.close();
} // doBoth
Search WWH ::




Custom Search