I am providing files which provide three things for use in your projects:
Much of this was originally done by one of the programming groups in last year's MCS 270 class. (The group consisted of Justin Delegard, Finn Kuusisto, Dan Messerschmidt, Ryan Rud, and Jared Wangen). Also, Zach Armstrong came up with the mechanism for handling redirecting to other files. They all did a great job setting this stuff up, and I just did a little tweaking around the edges.
These files are available to you in the following directory:
~karl/public/270/jsp/utilities/
This directory is set up with the same general directory structure as
I used in the gened example you used for lab 4. I
recommend that you not copy this directly into your CVS work
directory, but instead copy somewhere else so that you can see how it
works, and then copy the portions you want to use into your CVS work
directory.
The files Person.java and
LdapHandler.java allow you to look up and keep track of
information about users on the Gustavus computer system. The
LdapHandler is configured to look up the first and last
names of Gustavus users (though they will be set to empty strings if
the given user has chosen restrict such information). A call to the
constructor Person(String username) will cause the
LdapHandler to look up this information.
This package is currently named utilities. I recommend that you
simply copy the two files Person.java and
LdapHandler.java into your package directory and change
their package names to whatever you are calling your package.
Here are the Javadocs for Person and LdapHandler.
The two files login.jsp and
loginProcess.jsp can handle logins for your application.
They do so in an unauthenticated manner, so that you can "login" as
anyone with a valid Gustavus username. (This is very useful for
testing your system, since you can pretend to be anyone; however, it
does not allow you to access any of the user's actual resources, of
course.) Note that the file loginProcess.jsp forwards
the user to index.jsp after logging in.
The two files header.jsp and footer.jsp
should be included at the beginning (respectively end) of each of your
JSP files; look for example at the file adminStart.jsp to
see how to include them. These files simplify your programming and
establish a level of uniformity to all of your pages. In particular,
note how they handle redirection.
You can also see how to handle redirection (forwarding) by looking
at the file formProcessor.jsp, which redirects to
generalStart.jsp.