Assignment # 4b
Learning Goals
- Understand how servlets, JSPs, and beans can be combined to form a MVC Web solution.
- Understand how to use JSTL and EL in a JSP.
- Understand how to compose a JSP from various components using the JSP include directive.
Project
This assignment is part of Project#1.
Assignment
In Assignment#3, you developed a servlet to instantiate and populate a Java bean with the data associated with the Sun registration
form. In addition, the servlet invoked an isValid method of the bean to determine if the form data was valid. In Assignment#4, you will extend
your servlet to send control to one of two JSPs, depending on the return from the isValid method call.
Assignment 4b is the second of three parts in assignment 4. The three parts of assignment 4 are:
- Create a form JSP and send a redirect (http header value) to the form JSP from your controller servlet. Your bean should have a scope that
outlasts the request object.
- Build a testing JSP that displays the attributes of the shared objects, along with data submitted from the browser.
- Modify the servlet so that it forwards the request to the form JSP if the data is not valid, and forwards to a congratulations JSP if the
data was valid.
Assignment Steps (4b)
- Develop a JSP for testing purposes. The JSP should display:
- All the attribute names and values for the session, ServletContext, and request objects,
- The names and values of all the request parameters (i.e., form data set),
- The names and values of all the http headers, and
- The names and values of your bean properties.
The items above should be displayed in HTML tables, similar to the examples given in class.
Hints
- Be sure that you have added the JSTL library to your project within NetBeans.
- You may need to insert the JSTL jar file in the lib directory under the WEB-INF directory. If your IDE does not already contain the JSTL
jar files, you will need to include the jstl.jar and standard.jar files. You can download these files from the Apache
project.