I have allowed extra time for the tutorial, so you will be able to resolve problems with accessing the database.
If you did not do a previous Tutorial, then create a web application named book in NetBeans. Review the web page that contains instructions on creating a servlet in a NetBeans project: Creating a Project in NetBeans
All previous Tutorials should still be able to be accessed and run from the application.
If you had errors in any of the previous tutorials, fix them, so that you do not lose points again for old mistakes.
Implement the Persistent Controller in the book web application. It must work exactly like the example from Chapter 5 of the book.
log4j-1.2.11.jar
(should already be there from Tutorial 4)
commons-collections-2.1.1.jar
(should already be there from
Tutorial 4)
commons-logging-1.0.4.jar
(should already be there from Tutorial
4)
commons-beanutils.jar
(should already be there from Tutorial
4)
shared
package in the Source
Packages folder.
InitLog4j.java
(should already be there from Tutorial 4)
HelperBaseCh4.java
(should already be there from Tutorial 4)
ButtonMethod.java
(should already be there from Tutorial 4)
HelperBaseCh5.java
HibernateHelper.java
PersistentBase.java
WebappListener.java
Controller.java
, and
ControllerHelper.java
in the ch5.persistentData
package in the Source Packages folder in NetBeans.
fall08_
prepended to your ocelot
user name. The name of your database is the same as your mysql user name:
fall08_username
jdbc:mysql://ocelot.aul.fiu.edu:3306/fall08_username
fall08_username
RequestDataPersistent.java
file
and place it in the ch5.persistentData
package.
RequestDataRequired.java
, from the
first part of Chapter 5.
Id
property as is outlined in the book,
PersistentBase
.
ch5.persistentData
package in the
Source Packages folder in NetBeans.
ch4.enhanced
controller, but copy them
into the ch5.persistentData
package.
form
method to POST. If you don't do this, then
you will always be stuck on the edit page.
Edit.jsp
file so that it will display any errors
generated by the validation of the Hobby
and
Aversion
.
id
, hobby
and aversion
for each row in the table. Place the data from each row on a separate line.
for
loop to iterate through the rows in the table.
You will need to add the taglib statement that includes the JSTL in the JSP.
/ch5/persistentData/Controller
.
create
initialization parameter to the servlet definition.
true
, to create the table the first time you
run the servlet.
false
, so that your
data will not be lost the next time Tomcat restarts.
listener
tag so that the WebappListener
will close resources when Tomcat shuts down.
When you are done with everything, your directory and file structure should
look like this.
Take a look at your log file, you will see that there are messages in it.
build -> web
-> WEB-INF -> logs
error.log
file. It will look something like this.
Before you submit your homework, be sure that you have set the
create
parameter in the web.xml file to
false
.
Be sure that your NetBeans project is configured so that .java files are added to the WAR file: Adding .java files to a WAR file
Clean and Build your web application. After doing this, navigate to the WAR file in NetBeans and verify that the .java files are included: View WAR File
In the operating system (not in NetBeans) navigate to the dist folder in the NetBeans project.
Deploy the WAR file on ocelot: Deploy a WAR File
WEB-INF/logs
directory in winscp or
on ocelot.
error.log
file to 606. This will
allow Tomcat to write to the file.
To hand in the assignment, zip the following directories into one ZIP file and upload it.
rm book.zip
zip -r book ~/cgs4854/webapps/book -x \*.jar \*.zip \*.war \*.nfs\*
~downeyt/cs/public/webftp/webftp.pl
Be sure that all your files and subdirectories are included in the zip
file.
After uploading, do not modify your files on ocelot until after your assignment
has been graded.