Servlet Write a simple Servlet class
- that correctly extends the HttpServlet class
- that correctly overrides the appropriate ancestor method
Describe why your servlet must be stateless
- Explain that the servlet model is multithreaded (1 thread/request)
- Develop threadsafe servlets by writing stateless servlets (without declared instance variables)
Not Covered : Servlet Lifecycle init(), init(config), ... Request Differentiate
GET and
POST HTTP methods
- Explain how parameters are stored in the request : in the URL or in the body of the HTTP request
- Identify what default HTTP method will be used when clicking on a link, submitting a form
- Know that HTML Forms can use both GET and POST
- Know that the HttpServlet.doGet() & doPost() are called accordingly.
Manipulate request Parameters
- Write code that retrieves parameters from the HttpServletRequest
- Identify when getParameter() will return null instead of a valid String
- Write code that handles multi-valued parameters and retrieves all the values that they contain.
- Know the correct syntax to pass parameters through a request added to the URL
Not covered: Questions regarding attributes should be placed in the "Attributes" category. Response Produce the
HTTP response body
- Obtain a PrintWriter from the HttpServletResponse object
- Set the content type of the HttpServletResponse and know that it must be set before the content.
Attributes Retrieve and Store attributes in each scope :
HttpServletRequest, HttpSession, ServletContext
- Explain that null will be returned by the getAttribute() if no attribute can be found
- Write code that iterates through all the attributes of a given scope
- Remove attributes from a given scope
Not covered: Related listeners Session
Understand JSESSIONID mechanism
- Describe the mechanisms that let the web container bind an incoming request to an existing session
- cookies
- URL rewriting
- hidden field
- Write code that concatenate the JSESSIONID to a URL using the HttpServletResponse.encodeURL() method.
Get the session and manipulate it
- Write code that retrieves an HttpSession object either by using the getSession() method or by creating a new one if needed using the getSession(boolean) method
Not covered: Related listeners are not part of this exam, questions regarding attributes should be placed in the "Attributes" objectives.
Servlet Context Understand the servlet context scope within a web application
- Identify the ServletContext instance is unique within a web application
- Write servlet code that gets a reference to the ServletContext object
Not Covered: Questions regarding attributes should be placed in the "Attributes" objectives. Structure and Deployment
Write a simple Deployment Descriptor
- Configure the web.xml correctly for a basic servlet
- Write a correct <servlet> element ...
- ... and the corresponding <servlet-mapping> element
- Write correct <load-on-startup> element.
Describe a correct directory structure for a
WAR file
- Explain the web.xml must be placed in the WEB-INF directory
- .class files in the classes directory
- .jar files in the lib directory
- Static html files can be placed anywhere except inside the WEB-INF directory
- Identify which directories are accessible or not to incoming HTTP request URLs
Not covered: no questions on context listener nor init parameters