CGS4854 Assignment for Chapter 2
Due Friday, February 17 (not late until 8 am, 2/18)
You are to create a service oriented web site. You will be adding features
throughout the semester. The type of service that you provide is your choice.
For example, the site that was developed in the book kept track of a user's
hobby and aversion. Try to be creative in picking your site. There are already
enough book sellers on the web and one site that keeps track of hobbies is
enough. Choose a service that interests you.
Create a Web Application using NetBeans
- Create a new web application in NetBeans, named your-username
(replace your-username with your user name).
- If there is not a web.xml file in the WEB-INF folder, then select
New File -> Web -> Standard Deployment Descriptor (web.xml)
from the NetBeans menu.
- Use the secure web.xml file.
- Restrict access to this web site to you and me (this is controlled by
the secure web.xml file)
- Edit the tomcat users
file so that you can access your app in your local NetBeans.
- Modify the index.jsp that is in the root of the web app. Be
sure it uses the strict DOCTYPE (or the new, simpler HTML5
doctype).
- Add a paragraph of at least four sentences that describes service
that you are providing.
- Validate the JSP at http://www.w3c.org.
Servlet Controller
- Implement a servlet controller for your application. The controller
should behave like the servlet controller from Chapter 2 of the book.
- Modify Edit.jsp. Instead of the Hobby property that is used in the book,
use two properties of your choice. These properties should be useful
in the web site that you are developing.
- Do not use first name and last name. Be creative.
- Think of a web site that you would like to create and pick two
properties that are specific to that type of service.
- Later in the course, you will be adding additional fields to this
site for an integer, a floating point number and a calculation using
these numbers. Think of a site that will be able to be expanded in
this way.
- Modify the confirm and process pages with the new properties from the
edit page.
- Add appropriate paragraphs for your application to the edit, confirm and
process pages. These paragraphs should contain descriptions of each page.
If you do not have good paragraphs, you will lose points on the assignment.
Pretend that this is a real web site that users are accessing. These users
do not know anything about your site. There should be information on each
page that explains what service you are providing and what the user is
supposed to do on the current page. Unless you are William Faulkner, a
paragraph contains more than one sentence.
- In addition to the Edit, Confirm and Process pages,
create another JSP that will also display the data that is sent to it.
- Name the page WishList.jsp.
- The wish list page will display the data from the fields that are
sent to it, but will not let the user edit them. Eventually, this is a
page where users will be able to store information, without purchasing
it.
- Add an appropriate description to this page for your web application.
If you do not have a good description, then you will lose points.
- Add buttons to the wish list page that can send the user's data back
to the edit page or to the confirm page. Do not add a button for the
process page.
- Add a button to the confirm page that can send the user's data to the
wish list page. This is a new button, in addition to the edit and
process buttons. Do not add a button to either the Edit page or the
Process page for the WishList page.
- Add a hypertext link in the index.jsp page of the username web app to the
visible URL of your controller. Use a relative link.
- The web app must use the secure web.xml file and should only allow
you and me to access your application: Edit tomcat users
- Be sure to modify the project so that the .java files are
placed in the WAR file: Configuring WAR
File
Configure the Tomcat server
If you have not already received your host number from me, then do the
following.
- Connect to ocelot
- Change the permission on the
~
folder to 705.
- Edit the
.cshrc
file that is located in your home
directory. Add the following statement to the end of the file.
Be sure to hit enter at the end of the line.
umask 072
- Log out and then log in again. This will implement the change you
just made. From now on, all your folders and files should be created
with the correct permissions.
- Create
and validate
your webapps folder on ocelot and request your student host. You may use
winscp to create the webapps. Use these step-by-step
instructions to create the ROOT web app using winscp. Do similar steps
to create the manager web app, but be sure to use the web.xml file for the
manager.
- Access the Tomcat server by using the student host that I send you:
http://student99.cgs4854.cs.fiu.edu:8008/
- Access the manager application through the student host that I send
you:
http://student99.cgs4854.cs.fiu.edu:8008/manager/html
Deploy the Web Application
- In NetBeans, select Clean and Build to recreate all the files in your web
application. This will also create the WAR file for the web application.
- Connect to
ocelot.aul.fiu.edu
using winscp (or another
secure shell telnet program). Your username is your panther mail and the
password is first initial, followed by panther id, followed by last
initial.
- If you do not have one then, create a folder named cgs4854 on
ocelot.
- Navigate to the directory on your local machine that contains your
NetBeans project, then open the dist folder.
- Copy the WAR file from your local machine to the cgs4854 directory
on ocelot. Do not copy the WAR file to the webapps folder.
- Right click the name of the WAR file in the remote window of winscp.
Select Custom Commands and then select Enter. Be sure to check the box for
Show Results in Terminal.
If the name of the war file is your-user-name.war, then enter the following
command into the command box and hit enter. Replace your-user-name
with your user name. Replace your-user-name with your user name
unzip -o your-user-name.war -d
webapps/your-user-name
Modify index.jsp in the ROOT Web Application
- In winscp, navigate to the
cgs4854/webapps/ROOT
folder.
- Create a file named index.jsp.
- Enter all the HTML tags for a standard page.
- Use the strict DOCTYPE (or the HTML5 one).
- Validate the page at http://www.w3.org.
- Add a relative hypertext link to your username web application. Remember
that
/
on Tomcat means webapps/ROOT
in the file
system and /username
means webapps/username
in
the file system.
- Add a relative hypertext link to the manager application. The
absolute link to the manager is
http://student99.cgs4854.cs.fiu.edu:8008/manager/html
- Add a paragraph of at least four sentences that describes your web site.
This paragraph must be different from the other two that you have created.
Access the Web Application
- You should now be able to access the ROOT web application with
http://student99.cgs4854.cs.fiu.edu:8008/
- From this page, you should have a link to the root of your username web
application.
- After clicking the link, you should have a link to the JSP for this
assignment.
- You can also access the manager with
http://student99.cgs4854.cs.fiu.edu:8008/manager/html
- Try stopping the username web application, then try to access the
application from the web. You will receive an error.
- Next, try starting the username web application, then try to access the
application from the web. You should now have access.
Handing in the assignment
- To hand in the assignment, zip your cgs4854 directory and upload
it via the web: Submitting
homework on-line via the Web.
- Please use the following command to compress your cgs4854
folder. Change to your root directory on ocelot and issue the
command
zip -r username cgs4854 -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/public/webftp/webftp.pl
- 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.