CGS4825 Assignment 3
Due Friday, 11/11 at 11:59 pm.
You will not be able to upload your webapps folder, because it will be too large.
My upload program only allows for a file of up to 1 MB.
- Please use the following command to compress your web application. Do not compress 'webapps',
just compress your web application. Change to the webapps directory on ocelot and issue the
command
zip -r username username -x \*.jar \*.zip \*.war
Replacing username with the name of your web application.
- If you
have any other archived files in your directory, like .rar, or .ZIP, or
.WAR, please remove them before zipping.
- Check the size of the ZIP file, it should be less than 1 MB. If it is not, then you probably
have another ZIP file stored in the ZIP archive. Delete it and re-zip.
-
Use my uploading program from ocelot to upload the file.
~downeyt/cs/public/webftp/webftp.pl
- Upload the file as binary.
Do not modify your files on ocelot until after your assignment has been graded.
Add the jar files to the lib directory for the Standard Template Library,
Populating a Bean, Validating with Hibernate, Persistence with Hibernate,
and the MySQL connector. There is a ZIP file for this in Chapter 4 of the
book.
Create a subdirectory named hw3 in the root of the new web application.
-
Map the controller servlet for this homework to this directory.
-
Add an index.html to this directory. Include a hypertext link to the controller
servlet for this homework.
Include a link to the hw3 directory in the index.html of your web
application root.
Create a subdiretory of WEB-INF named hw3_JSP. Create three JSPs in
this directory
-
Edit.jsp This page will be similar to the first page that was created
in HW2. Initialize the form elements with corresponding values from the query
string.
-
Confirm.jsp This page will display the data that was sent to it. Also,
it will have hiddden fields and two buttons for sending the data to the Edit
or Process pages.
-
Process.jsp This page will display the data that was sent to it. Also,
it will have hidden fields and a button for sending the data to the Edit
page. It will also display all the data from the database for this application.
-
Display your name and the oath on each page.
Create a bean that will encapsulate the form data.
-
All hidden field data and methods should be in the bean.
-
Add validation for all three of the text fields. Decide on your own validation.
Each validation should be different. Here are some suggestions
-
Validate the number of words in an element
-
Validate the case of words in an element
-
Validate the format of an element. Do not use zip code, SSN, nor user id.
-
Validate the range of a numeric element.
-
Be sure that your JSP indicates what a valid element looks like.
-
Use annotations for validation.
-
Use annotations so that the bean can be saved to a database. Do not save
the hidden fields to the database.
Create a controller servlet in a package named hw3_servlet that will control
the above JSPs.
-
Since the JSP files are not in the directory to which the controller is mapped,
you cannot use a reference that is relative to the current directory when
calculating the address of the JSPs. You will need to use an address that
starts from the root of the web application.
-
Every time you change the .class file for the servlet on ocelot, you will
need to reload the web application.
-
Every time the controller is accessed, create a bean object and populate
it from the request using the the populate method.
-
Create a log file and write error messages to it in case the bean cannot
be populated.
-
When the user first accesses the page from a link or by typing in a URL,
then do not display any error messages.
-
After the user enters the data on the first page and clicks the button, validate
that the data is correct. If it is not correct, then return control to the
first page and display detailed error messages describing why the data is
invalid, otherwise continue to the second page.
-
When the user goes to the final page, write the bean to the database. Display
the current data as well as all the data from the database.