A Simple Servlet That 
Generates Plain Text
import java.io.*; 
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello World");
}
}
11
Servlets
www.corewebprogramming.com
Generating HTML
Set the Content Type header
Use response.setContentType
Output HTML 
Be sure to include the DOCTYPE
Use an HTML validation service
http://validator.w3.org/
http://www.htmlhelp.com/tools/validator/
12
Servlets
www.corewebprogramming.com
6




  

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