CGS4854 Assignment for Chapter 3
Due Friday, 10/12 (late 6am, 10/13)
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.
Apache
Apache server.
- Request
a port and start your server.
- Configure
your server.
- Add JkMount directives to the httpd.conf file for the following.
- All paths that start with /manager/*
- All paths that start with /username/*
- The path /username
- Remove the JkMount for examples.
- Add a folder named styles in the docRoot folder.
- Add a stylesheet to the folder.
- In the stylesheet, set the default background color and text color.
- Use contrasting colors so the text can be read easily.
- Add an index.html page to the docRoot
directory. The file is HTML not a JSP.
- Include all the standard tags.
- Validate the page.
- Include a relative link to the root of your web application for
homework.
- Incude a relative link to the root of your web application for
tutorials.
- Include a relative link to manager/html.
- Include a paragraph explaining your web site.
- Include the stylesheet for this page.
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 HTML 5 DOCTYPE and Meta tags.
- Add a paragraph of at least four sentences that describes the service
that you are providing.
- Validate the JSP at http://www.w3c.org.
- Use the stylesheet. The stylesheet only needs to work when the page is accessed from Apache.
Reorganised Controller
- Implement a servlet controller for your application. The controller
should behave like the reorganised controller from Chapter 3 of the book.
- All the JSPs in the application should use the stylesheet. The stylesheet only needs
to work when the pages are accessed from Apache.
- Modify Edit.jsp. Instead of the Hobby and Aversion properties that are used in the book,
use three 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 three
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.
- Use at least one field that has a reasonable default value.
- The user will enter data into the field in the Edit page. Initialize
the input element with the corresponding data in the query string.
- Do not use a default value like "No Hobby" or "No Aversion".
Choose a valid default value that makes sense in your site. You
must test for more than null and empty.
- 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.
- Echo the value of the field in the Confirm, Process and WishList
pages.
- Create a bean for the web application.
- Place it in the same directory as the controller.
- The bean should have a property for each input field that you have in
your edit JSP.
- Add default validation for at least one field. You do not need default
validation for all the fields, but you may validate all fields.
- Create a controller helper for the web application.
- Place it in the same directory as the controller.
- Modify the controller helper so that it can process all four of your
pages.
- Modify the controller helper so that it uses your bean and
initializes your bean with the data in the query string.
- Change the name that is used to store the helper in the session (do
not use "helper"). This will change how you access your data in the
JSPs.
- Change the name of the getData method in the controller helper. This
will change how you access your data in the JSPs.
- Place the helper base file in the same directory as the controller. Do
not make any changes to the helper base file.
- Rewrite the controller so that it uses a controller helper.
- Place your JSPs in a visible subdirectory. Modify the pages so that they
use the helper in the session to access the bean and its properties.
- Add a hypertext link in the index.jsp page to the servlet mapping for
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
- After the app is running in NetBeans, upload it and run it on ocelot: Uploading a WAR file
ROOT Web Application
Be sure you have the following links in the ROOT/index.jsp file.
- Relative link to manager/html.
- Relative link to the root of your web application for homework.
- Relative link to the root of your web application for tutorials.
- Absolute link to your student host using your Apache
port.
Include the stylesheet for this page. The style sheet only has to work when the page is accessed from Apache.
Hand In Assignment
To hand in the assignment, zip the cgs4854 directory and upload it.
- Please use the following command to compress your cgs4854
folder.
zip -r username ~/cgs4854 -x \*.jar \*.zip \*.war
Replacing username with your user name. This will create a file
named username.zip. It contains the ROOT, manager and username web
applications.
- 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/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.