import javax.servlet.*;
import javax.servlet.http.*;
public class UselessServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException {
doService(req, res);
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException {
doService(req, res);
}
public void doService(HttpServletRequest req, HttpServletResponse
res)
throws ServletException {
// Service GET or POST here
}
}
Figure 66. Implementing doGet and doPost with doService
Parameters are passed to the servlet in the HttpServletRequest object. The
getParameter method of the HttpServletRequest class is used to obtain these
parameters. For example, if our servlet UselessServlet is accessed with a
GET request of the following manner:
http://bdtest1/servlet/UselessServlet?password=elephant
we can obtain the parameter value for password using the following code:
String password=req.getParameter( password );
Although the parameter is not showed in the URL, the POST method also
retrieve these parameters using the HttpServletRequest object. Therefore,
the same code can be for both the GET and POST method.
Table 5 shows the list of servlets that we use and the environment that they
run on.
Table 5. Servlet list
Servlet name
Function
Environment
TestDB2
Test DB2 connection
DB2
TestDomino
Test Domino connection
Domino
80
Linux Web Hosting with WebSphere, DB2, and Domino




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved