Review: Getting Started
(Continued)
Main servlet code goes in doGet or doPost:
The HttpServletRequest contains the incoming 
information
The HttpServletResponse lets you set outgoing 
information
Call setContentType to specify MIME type
Call getWriter to obtain a Writer pointing to client
One time setup code goes in init
Servlet gets initialized and loaded once
Servlet gets invoked multiple times
97
Servlets
www.corewebprogramming.com
Review: Handling Form Data 
(Query Data)
Query data comes from HTML forms as 
URL encoded name/value pairs
Servlets read data by calling 
request.getParameter("name")
Results in value as entered into form, not as sent over 
network. I.e. not URL encoded.
Always check for missing or 
malformed data
Special case: query data that contains special HTML 
characters
Need to be filtered if query data will be placed 
into resultant HTML page
98
Servlets
www.corewebprogramming.com
49




  

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