CISC474, Homework H04, Spring 2007
Getting started with Servlets

Introduction

In this assignment, you'll create a Java Servlet

This is our introduction what is the central technology focus of the course.

You'll need your HFSJ Textbook (Head First Servlets and JSP)

The Head First Servlets and JSP text is designed to be a hands on textbook. Typically, as you read, you also need to have a a web browser open, and at least one terminal window open to a system where you are runnning Tomcat. That is definitely true of both Chapter 1 (the basis of this assignment), and Chapter 3 (the basis of a future assignments.)

Required Reading

  1. topics/java/basics/compilingOnStrauss/compilingOnStrauss.txt
  2. topics/tomcat/generalInstallAdvice/sharedInstall.txt
  3. Head First Servlets and JSP (HFSJ), Ch 1

Overview

In this assignment, you will:

  1. Make sure your strauss account is configured for Java 5.0.
  2. Setup a Tomcat server on strauss under your home directory.
  3. Deploy the web app from Chapter 1, pages 30, 31 in HFSJ (this is an example of a Servlet).
  4. Demonstrate that your web apps works to your instructor or TA (during lecture, instructor or TA office hours).

Step 1: Configure your account for Java 5.0

You need to have your account properly configured for Java 5.0 in order to be able to use Tomcat. See the following file for instructions:

topics/java/basics/compilingOnStrauss/compilingOnStrauss.txt

Step 2: Setup a Tomcat server on strauss

The steps to set up a Tomcat server on strauss are provided in the file:

topics/tomcat/generalInstallAdvice/sharedInstall.txt

Step 3: Deploy the web app from HFSJ pp 30-31

You'll need p. 30-31 of your textbook. You should also look at the reading notes for p.30 and p.31 which offer some advice on how to tailor the instructions p. 30-31 to the environment on strauss.

To show that this is your web app, modify the app just slightly: change the lines that says:

   out.println("<html>" +

to say:

   out.println("<html><head><title>Fred's Ch1 Servlet</title></head>" + 

except, put your name, not Fred. Unless your name is Fred. You may also modify the part that says HF\'s Chapter 1 Servlet inside the <h1> element to be Fred\'s Chapter 1 Servlet if you like.

Step 4: Demo your servlet to your instructor/TA

We'll give you some time in class during the next several class periods in which you can do this. Consult the course calendar for details. You can also demo your servlet during Oana's office hours, and Prof. Conrad's office hours.

In fact, if you are free and can stop by the instructors office hours or the TAs office hours, we'd appreciate that, since it will save us some time during class, and we'll have more time to get to know you better.

Or, you can just send us an email with subject line "CISC474 H04 " and the URL of your app in the body.; we'll know it's yours because of the name in the Title bar. Once we've noted that it is working, we'll send a return email inviting you to shutdown your server (to conserve CPU cycles on strauss—that "funny money" that shows up when you log in.)

Next Steps: Read Chapter 2 in HFSJ

Now read Chapter 2. As you read, you may also want to consult the reading notes for HFSJ Chapter 2 on the course web site.

Chapter 2 is unusual in that it is not a "hands on" chapter, but more of a "theory" chapter. So unlike Chapters 1 and 3, you don't need to be sitting at the terminal to read it.


Alfred Hitchcock, master of suspense. Public domain image from Wikimedia commons.

Focus on the concept of MVC: Model-View-Controller

This is a key learning objective for this course—it is right there on the syllabus:

This chapter tells a story—and you know I am very big on telling stories—about the MVC design pattern. As I am fond of saying, stories have a beginning, a middle and an end. However, Chapter 2 only tells the beginning, and the middle of the story. The end is saved for Chapter 14 of the textbook, creating "suspense".

Ok, done with reading Chapter 2—what next?

Next, of course, we'll work through Chapter 3, which is another hands on chapter (similar to Chapter 1.) This will be the basis of one of your upcoming homework assignments. If you want a preview, look at Spring 2006 H02 from last year's course.

Before I assign this officially, I hope to improve and streamline the instructions. We also have to finalize a few details about working on the ACAD systems (porsche, etc.) including assigning port numbers.

But if you just can't wait to get started, feel free to go ahead—but, for the time being, working on strauss—on the basis of last year's instructions. The substance of what you'll be doing won't be significantly different from what we did last year, and if you get everything working on strauss, it will be easy to migrate to porsche once those details are finalized.

Grading: 40 points

Due Date: Mon 02/26, 3PM


Valid XHTML 1.0 Valid CSS!