CGS4854 Tutorial 5
Due Thursday, 3/26 at 1 pm.
If you did not do a previous Tutorial, then create a web application named
book in NetBeans. Review the web page that contains instructions on
creating a servlet in a NetBeans project:
Creating a
Project in NetBeans
All previous Tutorials should still be able to be accessed and run from the
application.
If you had errors in any of the previous tutorials, fix them, so that you
do not lose points again for old mistakes.
Implement the Post Controller in the book web application. It must
work exactly like the example from Chapter 5 of the book. It uses many of
the files from the Required Validation Controller.
-
Follow the instructions for the Required Validation and Post applications
on the book's
web site.
-
Add a hypertext link in index.jsp to the Post controller.
-
Be sure that the index.jsp uses the strict DOCTYPE.
-
Use a relative link from the current location to the controller. Use the
url-pattern from the web.xml, but omit the leading /.
-
All the previous Tutorials should also have links from this page. All of
them should still work.
Take a look at your log file, you will see that there are messages in it.
-
Open the Files tab in NetBeans and navigate to
build -> web
-> WEB-INF -> logs
-
Open the
error.log
file. It will look something like this.
Submitting Homework
Be sure that your NetBeans project is configured so that .java files are
added to the WAR file: Adding
.java files to a WAR file
Clean and Build your web application. After doing this, navigate to
the WAR file in NetBeans and verify that the .java files are included:
View WAR File
-
Since you are using a log file that is in the web application, you will need
to shut down Tomcat before you can do a Clean and Build.
-
Open the Services (Runtime in 5.5) folder and open the
Servers folder.
-
Right-click the Tomcat server and select Stop.
-
Now you can do a Clean and Build.
In the operating system (not in NetBeans) navigate to the dist folder in
the NetBeans project.
Deploy the WAR file on ocelot:
Deploy a WAR
File
-
After deploying, open the
WEB-INF/logs
directory in winscp or
on ocelot.
-
Change the permission of the
error.log
file to 606. This will
allow Tomcat to write to the file.
-
Access your application and visit all the pages, then verify that some new
messages have been added to the log file.
To hand in the assignment, zip the following directories into one ZIP file
and upload it.
-
First, delete the current book.zip file
rm book.zip
-
Next, please use the following command to compress your
cgs4854/webapps/book folder.
zip -r book ~/cgs4854/webapps/book -x \*.jar \*.zip \*.war
\*.nfs\*
Replacing book with the name of your book web app, if you used a different
name. This will create a file named book.zip. It contains the book
web application.
-
Check the size of the ZIP file, it should be less than 3 MB. If it is not,
then you probably have another ZIP file stored in the ZIP archive. Delete
it and re-zip.
-
You then have a choice for submitting the file.
-
If you are logged onto ocelot, use my uploading program to upload the file.
Enter this command at the command prompt:
~downeyt/cs/public/webftp/webftp.pl
-
If you are using winscp, then download the zip file to your computer; then,
upload the file to me:
Submitting
homework on-line via the Web.
-
Upload the file as binary.
Be sure that all your files and subdirectories are included in the zip
file.
After uploading, do not modify your files on ocelot until after your assignment
has been graded.