Homework 1
CS320, Spring 2011


Due: Thursday, April 14

Please upload your files to CSNS. The files should include all the source code, documentation (optional), and an HTML file hw1.html, which contains a link to your application deployed on the CS3 server. Note that file uploading will be disabled automatically after 11:59PM of the due date, so please turn in your work on time.


[Readings]

[CS320Answers]

This quarter we are going to implement a web application called CS320Answers, which is similar to Stack Overflow where people can post questions and get answers. In this assignment, you are going to implement some basic features using servlets or a combination of servlets and HTML pages.

1. (30pt) The Question List page shows the list of the questions that are currently in the system:

CS320Answers - Questions
Question Posted By Post Time Tags
I run into a 404 error! John 2011-03-05 8:01AM javaee servlet
Tomcat cannot restart John 2011-03-05 5:37AM javaee tomcat
What are the differences between Java an C++ Generics? Tom 2011-03-04 11:30PM java c++ generics
How to get a request parameter in a servlet? Jane 2011-03-04 7:10PM servlet
Post A Question

Note that the list of questions should be sorted by Post Time in descending order, and Post Time should be formatted as shown in the example above.

2. (10pt) When a user clicks on a tag, only the questions with that tag should be displayed. For example, if a user clicks on the "servlet" tag, the display should be changed to

CS320Answers - Questions
Question Posted By Post Time Tags
I run into a 404 error! John 2011-03-05 8:01AM javaee servlet
How to get a request parameter in a servlet? Jane 2011-03-04 7:10PM servlet
All Questions | Post a Question

And clicking on the All Questions link should take the user back to the full question listing.

3. (20pt)  When a user clicks on the Post a Question link, the application shows the Post Question page where the user can post a new question:

CS320Answers - Post A Question
Your Name:
Question Title:
Question:
Tags:

Tags are keywords of a question. Each tag is a single word with lower-case letters. Each question must have at least one tag, and multiple tags are separated by white spaces. 

3. (20pt) After a user posts a new question, or when a user clicks on a question in the question list, the application displays the question and its answers as follows:

CS320Answers - Question - Tomcat cannot restart
Back to Questions
Posted by John at 2011-03-05 5:37AM
I have got this problem.  After I set up the hMailServer.  The tomcat server can't be started anymore.
It says the ports used by Tomcat is using by other processes.  I closed all other processes but it still gives the same error.
Thanks,
Tags: javaee tomcat

Answers:

Posted by Tom at 2011-03-05 6:15AM
Well, I guess that your 8080 port is already assigned to some other tomcat server or service. Go to Services and try to stop that one. You can turn off auto start from its properties.
Posted by Jane at 2011-03-06 5:23PM
Have you checked if you have another service running at the port 8080?

Submit an Answer:

Your Name:
Your Answer:
 

Clicking on the Back to Questions link should take a user to the Question List page.

4. (20pt) A user may use the form on the Question Display page to submit an answer to a question.

[NOTES]