Servlet Instructions


You could use servlet technology to finish the first programming assignment.  To deploy servlets you implement, put your *.jar files in /afs/eos/lockers/workspace/csc/csc513/YYY/XXX/WEB-INF/lib directory. Or compiled classes in /afs/eos/lockers/workspace/csc/csc513/YYY/XXX/WEB-INF/class directory. Here YYY is the course section number, XXX is your UnityID. In the later case, add an entry in your web.xml under the WEB-INF file. You could find the sample web.xml to get start learning how to write web.xml, or refer to the Chap. 13 of Servlet Specification for details. For the later case, you should validate your servlets before deploying them into the course Tomcat server. Please read FAQ before you start.

A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model.  The most important advantages Servlet could provide us are: Long Life Cycle; Independent Memory Space while a servlet is running; Simplity; and flexibility. The Servlet API is composed by two packages: javax.servlet and javax.servlet.http. Such packages refer Tomcat as its recommended web app platform. You could start Tomcat, and use URL http://localhost:8080/tomcat-docs/servletapi/index.html to check these APIs.

The most important APIs are list in the below table:

Categories javax.servlet javax.servlet.http
Generic Servlet, GnericServlet, ServletException, UnavailableException HttpServlet
Environment

Config, ServletConfig, ServletContext, ServletContextAttributesListener,

ServletContextListener,ServletContextAttributeEvent,

ServletContextEvent,ServletContextEvent

/
Request ServletRequest, ServletRequestWrapper, ServletInputStream HttpServletRequest, HttpServletRequestWrapper
Response ServletResponse, ServletResponseWrapper, ServletOutputStream HttpServletResponse, HttpServletResponseWrapper
Session N/A HttpSession, HttpSessionAttributesListener, HttpSessionBindingListener, HttpSessionBindingEvent, HttpSessionEvent
Others Filter, FilterConfig, RequestDispatcher, SingleThreadModel Cookie, HttpUtils

Servlet Life Cycle

The key concept about servlets' development is the life cycles of servlets. A life cycle of a servlet consists of four stages: Initialization -> Listen Request from client-side -> Constructing Response -> Finalization. All you need to do is to implement and overide Servlet service methods. 

Also you should concern such issues:

For more information about Servlet technology, visit http://java.sun.com/products/sevlet. For official specification , visit Java Servlet 2.3 Spec.

                   

  Go Back To TA Page   


Course Webpage | JSP | Servlet | Apache Ant | Apache Jakarta Tomcat | FAQ | Contact Us