Configuration Web Server Tomcat - Install JDK Install Tom cat Configure Tom cat for running Servlet C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf Open web.xml with WordPad and uncomment
invoker org.apache.catalina.servlets.InvokerServlet debug 0 2
invoker /servlet/*
Test Your Web Server Open IE: Port: 9999 Ask your friend test your web server:
Successfully
Unsuccessfully
Fix Web Server Make sure you start Tomcat Service (Control Panel -> Administration Tool -> Service -> Start (Apache Tomcat Service) Make sure you type correct port
First Servlet import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n"; out.println(docType + " \n" + " Hello \n" + " \n" + " Hello First Servlet \n" + " "); }
First Servlet Folder Location for Servlet Class file C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes If you change servlet code, you should restart the Tomcat Service to updating new code Test your Servlet:
First JSP First Hello JSP <% out.println(" Hello JSP "); %>
Run the first JSP Folder Location for Servlet Class file C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\hello.jsp Test your JSP File: Open IE
Input Class
ESL Registration
Student Grade / Semester
ESL Registration for Officer Module
Design Web Page for inputting An Employee An Employee has first name, last name, id, birthday, gender, Type of employee (Full Time or Part time), education (B.A., Master, or Doctor)