CGS4854 Extra Credit 6

Due Tuesday, 11/12 (late 11/13 at 6am)

This tutorial will take longer than other extra credit. Start earlier.

Use the same web application that you used for previous extra credit. If you did not do a previous Tutorial, then create a web application named Tutorials in NetBeans. Review the web page that contains instructions on creating a servlet in a NetBeans project: Creating a Project in NetBeans

All previous Extra Credit should still be accessible and runnable from the application.

If you had errors in any of the previous extra credit, fix them, so that you do not lose points again for old mistakes.

Implement the Persistent Controller in the Tutorials web application. (Do not implment the example that uses a separate config file for Hibernate.) It must work exactly like the example from Chapter 5 of the book. The example from the book also does required validation and uses POST and GET.

Detailed instructions can be found on the book's website: Ch5 Tutorials

When you are done with everything, your directory and file structure should look like this. Note:

Take a look at your log file, you will see that there are messages in it.

Common Problems

In the event that you cannot connect when you try to access the controller, then Tomcat will get stuck. You will not be able to stop it or start it. Follow one of these steps to free up Tomcat

  1. Drastic: Reboot
  2. Not so drastic: open the task manager; click the processes tab; sort by process name; look for java.exe; stop them. One of the java.exe processes is Tomcat. Kill it and you will be able to start it again. Before you start it again, be sure you have found the database configuration error that caused the original problem.

Connecting to a database for the first time can be frustrating. Most of the time, the problem is with the username and password for mysql.

Test the connection in NetBeans

  1. Open the Services tab.
  2. Right-click the Databases folder.
  3. Select Add New Connection.
  4. Select the MySQL driver from the Driver drop-down list.
  5. Click Next.
  6. Set the Host to ocelot.aul.fiu.edu
  7. Set the port to 3306
  8. Set the database to spr16_username
  9. Set the user name to spr16_username
  10. Set the password to your password (initial password is pid)
  11. Click Test Connection
  12. If it does not succeed, then you have a problem. Make changes and try again.
  13. Click Cancel after you have connected successfully.

Submitting Homework

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

The WAR file is too big for you to submit to me. To hand in the tutorial, zip the Tutorials web app directory and upload it. If your web app is named something other than Tutorials, then use that name in the zip command.