CGS4825 Assignment 2
Due Friday, 2/17 at 11:59 pm.
To hand in the assignment, zip your webapps directory and upload
it via the web:
Submitting
homework on-line via the Web.
-
Please use the following command to compress your cgs4825 folder.
Change to your root directory on ocelot and issue the command
zip -r username cgs4825 -x \*.jar \*.zip \*.war
Replacing username with your user name.
-
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.
Be sure that all your files and subdirectories are included in the zip
file.
Do not modify your files on ocelot until after your assignment has been graded.
Create a New Web Application
Your are to create a new web application on ocelot. The name of the web app
should be your user name. Use the secure web.xml file for this
application.
After creating the new web application, open the manager application for
your host. In the Deploy section, enter the name of the web application
in the WAR or Directory URL: text box and click the Deploy
button. If all went well, then you will see that your new web appication
is running. If it is not running, then check that you have no errors in your
web.xml file.
Edit the file named .cshrc in your ~
directory. Add the
following commands to the end of the file
#
#Define the location of Java
#
setenv JAVA_HOME /depot/J2SE-1.5
#
#Define the location of Tomcat
#
setenv TOM_HOME /home/ocelot/aul-user-web/jakarta-tomcat-5.0.19
#
#Add directories and jars to the CLASSPATH
#
setenv CLASSPATH {$HOME}/cgs4825/webapps/ROOT/WEB-INF/classes
setenv CLASSPATH {$CLASSPATH}:{$TOM_HOME}/common/lib/servlet-api.jar
setenv CLASSPATH {$CLASSPATH}:{$HOME}/cgs4825/webapps/your-user-name/WEB-INF/classes
Replace your-user-name
with your user name. These commands will
allow you to compile java servlets on ocelot.
Configure the Apache Server
-
Enable SSI.
-
Turn on SSI for all paths in the server.
-
Create a directory named includes in the document root.
-
Create a file named header.html in this directory. Include some text
in a predefined heading and a horizontal rule.
-
Create a file named footer.html in this directory. Include a horizontal
rule and some text in italics.
-
Add cgs4825.shtml as the first choice for a directory index.
-
Change the extension on the error files to .shtml. Change the directives
that point to the error files.
-
Using SSI, include the header and footer files in the
cgs4825.shtml and all the error pages.
-
Forward the following references to your Tomcat server
-
All JSPs in the document root.
-
All URLs that start with
/manager
.
-
All URLs that start with your /username (replace username...
yada, yada, yada).
-
Be sure that all the hypertext links from hw1 work properly.
-
Add the following hypertext links to the cgs4825.shtml file.
-
A relative hypertext link to the manager application for your Tomcat
host.
-
A relative hypertext link to the username application of your
Tomcat host.
-
A relative hypertext link to the cgs4825.jsp file in the root
of your Tomcat host.
Configure the Tomcat Server
-
Create a cgs4825.jsp file in the root of the username web
application.
-
Create the following UNIX symbolic links.
-
Create a symbolic link in the Tomcat document root to the includes directory in the
Apache document root.
-
Create a symbolic link in the root of the new web app to the includes directory in
the Tomcat document root.
-
Create a symbolic link in the root of the new web app to the errors directory in the
Tomcat document root.
-
If you have not already done so, then make the 404 error page a JSP not an
HTML page.
-
Using JSP directives, include the header and footer files in the 404 error
file, and in the cgs4825.jsp files in the document root and the new
web app.
-
Be sure that all the hypertext links from hw1 work properly.
username Application
-
In the cgs4825.jsp file in the document root of your host, create
a hypertext link to the root of this web application.
-
In the new web application, create a subdirectory named hw2.
-
In the cgs4825.jsp file in the root of this web application, create
a hypertext link to the hw2 directory.
-
Create two subdirectories of hw2 named simple and
controller.
-
Simple Application.
-
There will be four JSPs in the simple directory.
-
Three of them behave like the Edit, Confirm and Process pages that were covered
in class.
-
The Edit page should have three text boxes and a submit button. Initialize
the text boxes with the corresponding values from the query string.
-
The Confirm page should display the data from the Edit page as plain text.
It can also send the data to the Edit page, Process page, or Save page.
-
The Process page should display the data from the Confirm page as plain text.
-
Choose a common theme for these text boxes. Do not use name, address, city,
state, zip. One of the fields should be a field that can be used for
identification.
-
The fourth page is named Save, and can also be called from the Confirm page.
This means that the Confirm page will have three buttons: Edit, Save, and
Process.
-
The Save page will display the data from the Confirm page as plain text.
-
The save page can send the data back to the Edit page, or on to the Process
page.
-
Do not use a controller in the simple application. Each page must know the
location of the pages where it will send its data.
-
Servlet Controller Application.
-
There will also be four JSPs in the controller directory, as well.
They will be similar to the pages just described, except they will use a
controller.
-
Create a servlet controller in a package named
hw2.controller
.
-
The controller will manage the four JSPs in the
hw2/controller
directory.
-
In the web.xml file, map the controller to the
hw2/controller
directory.
-
In the cgs4825.jsp file in the root of the username web
application, add the following links.
-
A hypertext link to a file that does not exist.
-
A hypertext link to the Edit page in the simple directory.
-
A hypertext link to the controller servlet.