Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
* @web.servlet mapping url pattern="/BasicServlet"
*/
public class BasicServlet extends HttpServlet {
/** Initializes the servlet.
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
/** Destroys the servlet.
*/
public void destroy() {
}
/** 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, java.io.IOException {
ServletConfig config = this.getServletConfig();
String hi = config.getInitParameter("hi");
String bye = config.getInitParameter("bye");
try{
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println("");
out.println("");
out.println("Basic Servlet");
out.println("");
out.println("");
out.println(" bye:" + bye + "
");
out.println(" hi:" + hi + "
");
getJdbcPool(out);
out.println("");
out.println("");
out.close();
}catch(Exception e){
throw new ServletException(e);
}
}
/** Handles the HTTP GET method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, java.io.IOException {
processRequest(request, response);
}
Enhance J2EE component reuse with XDoclets
Page 7 of 49
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved