Why You Should 
Not Override service
You can add support for other types of 
requests by adding doPut, doTrace, etc.
You can add support for modification dates
Add a getLastModified method
The service method gives you automatic 
support for: 
HEAD, OPTIONS, and TRACE requests
Alternative: have doPost call doGet
public void doPost(HttpServletRequest request,
HttpServletResponse response)   {
doGet(request, response);
}
19
Servlets
www.corewebprogramming.com
Initializing Servlets
Common in real life servlets
E.g., initializing database connection pools.
Use ServletConfig.getInitParameter to read 
initialization parameters
Call getServletConfig to obtain the ServletConfig object 
Set init parameters in web.xml (ver 2.2/2.3)
 /WEB INF/web.xml
Many servers have custom interfaces to create web.xml
It is common to use init even when 
you don't read init parameters
E.g., to set up data structures that don't change during the 
life of the servlet, to load information from disk, etc.
20
Servlets
www.corewebprogramming.com
10




  

Home

About Services Network Support FAQ Order Contact
 

Servlet 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