SWE 432 Homework 9
Fall 2008
Servlet: CMS Data Persistence : Storage and Retrieval
Due 11/17
Confidence comes not from always being right but from not fearing to be wrong.
- Peter T. McIntyre
– We never know how much we can do until we fail. –
Extend your servlet from homework 8
by adding more functionality.
When the user submits the data about a course schedule,
instead of immediately responding with a schedule page,
your servlet must
save the data into a file on disk.
Also, add a button onto your servlet's initial screen
to
existing data from a file.
Thus,
the user will be able to enter data initially,
then load it in another session,
modify it,
and save it again.
It is very important that you decouple
the file reading and writing functionality from the rest of your servlet.
In the next assignment,
you will use a Java Server Page
to read and display the data from the file.
I recommend a design where the file reading and writing
is encapsulated into a separate Java class.
You may change your data form if you wish.
This homework assignment can be done with one partner.
If you work with a partner,
submit the assignment on both websites
and have both names on your program.
Submission
Submit the program by
(1) placing a link on your class web site
to the servlet executable file on the server
and
(2) by emailing the Java source file(s) to the TA.
Both must be submitted before the deadline to be on time.
IMPORTANT PROCESS CONSTRAINTS:
- The name of your servlet must start with your user name
(e.g., upraphamH9.java).
- Make sure your last name is on every HTML page and programming
artifact so we know who it belongs to – even if we print.
- If you finish the assignment late,
you need to send email to me and the TA
to tell us when to grade it.
This is your responsibility !
Hints
- Review servlet slide 47 for writing files from a servlet.
- Remember that the data file must be readable and writable
by the tomcat user
(whoever last rebooted tomcat on the server).
It is safest to make the file world readable and writable.
- Remember that Unix knows the difference between upper and lower case.
So "MyDataFile.txt" is the same as "mydatafile.txt" on your windows box,
but they are different files on our server.
- If you develop your servlet on your personal computer,
be sure to deploy test it when you move it to the server.
- If you develop your servlet on your personal computer,
remember to leave time to correct deployment issues.