In this lab, you will extend your work from the previous lab into a JSP architecture. In particular, you'll provide an interface which has two text fields in which the user enters the actor's first and last names, a radio button with which the user selects a store, and a submit button. When the user clicks submit, the two text fields are cleared, the radio button is left unchanged, and a table appears showing a list of titles of movies on the selected store's shelves which contain the selected actor.
In addition to allowing you to query your database, this will also provide you the ability to easily see more information about the movies, courtesy of The Internet Movie Database.
You should write the application from scratch, testing as you go. You should never be writing more than 10 or 20 lines of code before testing the code. Be sure you have a strategy for testing any code you write before you write it. If you need help with this, please ask.
You may wish to refer to the
gened application which I
went over in class. It's found in
I highly recommend keeping on your source files in one directory, and utilizing a Makefile to copy and/or compile files to the appropriate destinations. For instance, you could place all your files in
As discussed in class, a very simple GNUmakefile is found in the
gened/ directory. It should function so long as you have
at least one
jsp file and one compilable
.java file. Once you've placed the GNUmakefile in your
source directory, if you want to install all .jsp files, and compile
any .java files which you have edited since the last compile, type:
makeTo remove all backup files in the currect directory, type:
.java files will be compiled into
.class files in a subdirectory of the root directory
~/webapps/WEB-INF/classes, where the path name is determined by
the package name you use. Your
therefore include this root directory if you want to test your Java classes
in isolation. If you use a
csh shell, you can put the
following in your
setenv WOLFE ~wolfe setenv CLASSPATH $HOME/webapps/WEB-INF/classes:$WOLFE/public/270/mysql.jar:.If you use
bash, put the following in your
export CLASSPATH=~/webapps/WEB-INF/classes:~wolfe/public/270/mysql.jar:.You'll need to either open a new shell or type
README: This includes brief documentation on your application. This is the first file I will look at and should paint a broad overview of your submission. In particular, it should contain a clear statement about what you have successfully tested and any bug reports. I should be able to replicate your tests.
JSPfile containing the interface.
*Bean.java: Java Bean(s) which holds the name of an actor and the store selected. You'll need at least three setters, which set the first name, last name, and store, three getters.
If you choose separate Beans to store the actor and the store, provide
toString() method which returns the full name of the
actor or the store name. If you combine them into one bean, while you
may want to make getters which return strings, you may also want a
toString() method to use for debugging.
QueryHandler.java: A Java class file which composes the SQL query and returns a list of movies. Your SQL query should be performed using a
PreparedStatement, since your interface will have text fields. The
PreparedStatementshould only be made once by the QueryHandler object rather than once for each query the object handles.
query.sql: A sample SQL query which is hardwired with a specific actor of your choosing.
GNUmakefile: A makefile which installs your application.
jspfile, and what methods belong in auxilary classes?
Lab4, now type:
submit program prints
out to confirm it seems to have submitted properly.