CGS4825 Assignment 7
Due Thursday, 4/14 at 11:59 pm.
Create a new web app named hw7.
-
The simplest way to start this project is to copy the hw6 webapp to
hw7. Change to the webapps folder and issue these commands
umask 072
cp -r hw6 hw7
-
Copy the downey.jar file into the
lib directory of this web app.
-
Copy the coreservlets.jar file
into the lib directory of this web app.
-
Edit the .cshrc file on ocelot, and add a path to the classes
directory of this web app. Also paths to the downey.jar and
corservlets.jar file. Then run the command
source ~/.cshrc
-
Once you have created the web app structure, add the web app to your
host using your manager.
-
You should now have an exact copy of the hw6 web app in hw7.
Make sure that everything works, and that the style sheet is being used in
all the correct places. If you hardcoded hw6 anyplace in your web
app, then you will need to change all those references to hw7.
Modify the web app as follows.
-
Create a link in the ROOT/index.html to the root of this context.
-
Create a new mapping for sevlet to the root of the hw7 web app.
-
Map your servlet to
/your-user-name.your-servlet
-
Create a link in the hw7/index.html file to this servlet
-
Create a subdirectory of
WEB-INF
named hw7
.
-
Create an empty file for the database in the WEB-INF directory. Change
to the WEB-INF directory and issue these commands
touch hw7.db
chmod 606 hw7.db
-
Construct the database in the init method of the servlet.
-
Pass the following to the constructor to identify the path to the database
getServletContext().getRealPath("/WEB-INF/hw7.db")
-
Use the getError method of the database to know if there are any errors.
-
Personalize the Confirmation page so that it includes the email address that
was just saved.
-
Move the following methods from the servlet to the bean.
-
makeList
- Remove the bean parameter.
-
makeStyleSheet
- Remove the bean parameter.
-
warning
- Remove the bean parameter.
-
Add the following methods to the bean
-
getEmailClass
- Return the string
"class='error'"
if the email is not valid and the request
is from post. (Replace 'error' with the name of your stylesheet class
for indicating errors.) This method should have a boolean parameter that
will indicate if the request if from POST
or GET
.
-
Move the HTML code for the following methods to JSPs. Place the JSPs in the
WEB-INF/hw7
directory.
-
showPreview
-
showConfirmation
-
showForm
-
Instead of calling the above methods, forward to the corresponding JSP.
-
Pass the bean to the JSP.
-
Create the following files in the
WEB-INF/hw7
directory and
include them in each of the above pages
-
A banner that will display at the top of each page.
-
A footer that will display at the top of each page.
-
These pages only contain sections of HTML code, they should not contain all
the codes for a standard HTML page.
Configure your Apache web server
-
Request your port number.
Request Port
-
Follow the instructions for creating a web server on
ocelot
-
Modify the host directive in the workers.properties file in
the
cgs4825/server
directory
worker.worker1.host=studentXX.cgs4825.cs.fiu.edu
Replacing XX with your student host nuber.
-
Modify the JKMount directive in the httpd.conf file as follows
JkMount /hw7/* worker1
-
Start your server.
-
You should be able to access your hw7 web app from this
URL
http://studentXX.cgs4825.cs.fiu.edu:99999/hw7/
Replacing XX with your student host nuber, and 99999 with your
port number.
My example of
hw7