Sue, Fred, Brandon and Pat all need to work together in a group. However, they are having difficulties meshing their schedules to find times when they can meet. They really could use some kind of help from a web page, perhaps something with a story like the following:
Work together as a group to answer the following questions. Post your groups answers in an HTML file called A05.html, and link to this file from your group's existing home page. The link should be clearly marked as "A05 answers". Use valid XHTML 1.1 when writing this file.
You may want to divide up the questions initially, work on them individually for some time, then check in with each other. Also, look over all five questions before deciding which order to answer them in.
What is the actual output that the web page should return for this example (I've started the example above, but finish it out.)
Come up with another example of sample input and output, using the actual schedules of your own group as the input and output.
Design a simple HTML form for the story given above, and a simple HTML page with the response that comes back. Code these pages in XHTML 1.1, and add links to them to your A05.html page.
Now, considering what you are learning about how Java Servlets work, consider how you might write a web-app (using the MVC design pattern) to solve this simple problem. Modelling your solution after that in Chapter 3 of the HFSJ textbook (and your work on H02), you'll have:
a "model" of the problem—some plain old Java objects (POJOs) that model the objects in your problem (e.g. people's schedules)
a "view" of the problem—some HTML code that returns the results of the calculation—in this case, the list of the times when everyone in the group is available. A view is typically written as a JSP, which is a web page with some embedded Java in it (embedded in <% %> brackets). That Java code uses out.print("..."); statements to write out the HTML that represents the answer.
a "controller" servlet that takes the input parameters from the user, sends them to the model classes as input, gets back an answer, and sends that answer to the view (the JSP) to be output as HTML.
Some questions to consider about the Model part:
What Java objects might you need to create? What methods would they have?
How will you parse the input and turn it into some data structure that you can use to represent a "schedule"?
For this assignment, I'm not yet asking you to write the code in detail. What I'm interested in seeing is your overall plan of attack. Write a description of how you might apply what you've learned about the Beer-v1 servlet and the product servlet you are writing now to this problem, focussing especially on the Model classes (the POJOs that you are going to need to solve this problem.)
Look for the discussion board on WebCT for A05. Contribute at least one new idea to the "story" for this web app... i.e. a cool feature that would go beyond the simple story shown here.
It might be an easier way to specify the input, or a more convenient way for the output to be formatted, or a way that users could store information about their schedules in a database (assuming you have logins and passwords and stuff.)
Equally helpful—perhaps even more so—are ways to simplify the story. That is, is there any simplifying assumptions we could add to the story to make the first version of the web app still useful to real students, but easier to code? (Think, for example, of simpler ways to express the input and output.)
Careful though—Einstein is quoted as having said "Everything should be made as simple as possible, but not one bit simpler." Make sure you don't make assumptions that are so simplifying that they may the application not very useful (such as assuming that all obligations start and stop on even multiples of one hour.)
When your group has agreed on an idea, post your group's idea on that discussion board. THEN, go back through all the ideas that were posted BEFORE yours by other groups. If someone else already posted something essentially the same as your idea, then your idea won't count. In that case, go back to the drawing board, and come up with a NEW original idea.
Once you've posted your group's idea on WebCT and are satisfied that your group was the first to post it (or that your "take" on the idea is different enough to be considered separately from similar ideas posted earlier)—then and only then, copy that original idea to your A05.html web page.
If you need help figuring out how to format your answers nicely in XHTML 1.1, ask Oana or Prof. Conrad, or consult your Sebesta text or the many tutorials available on the web. You might also take a look at the CSS in this very file to see, for example, how the nice "box" around story above was made (hint: a CSS class applied to a div element).
A tip: the WebCT discussion boards accept XHTML formatted text.
Designate one person from your group who can be a spokesperson for your group for this activity. Identify him/her by name on your A05.html web page. She/he may have an opportunity to earn up to 5-10 extra points in a future class by presenting briefly your groups findings.
This assignment is worth up to 50 points (up to 10 points per question) towards the final course grade for each group member that participates in the activity. (Please contact me if any group member should not be given credit for participation.)