I tried to activate an example Web application with database but failed.
This example is done by:
1. Developing a
servlet context listener to initialize connection pool and place it in a global naming context
2. Configuring the deployment descriptor to declare the servlet context listener and set the servlet context initialization parameters
3. Deploying the Web application
4. Activating the Web application
This is an example of a Web application for playing
word games.
The servlet allows the user to play a "word scramble" game.
Next, the user is presented with a list of "word categories" to choose from. The user selects a category and clicks the Choose button, which presents her with the next view.
The next view is the main part of the scramble game. The user is presented with a scrambled word and is asked to enter the word in the text field. The user can also ask for a hint by selecting the checkbox. She then clicks the Guess button to process the request. The hint text appears in blue. The game is keeping track of how many "guesses" (including hints)she has made.
Below are software installed in my PC:
Windows98
Tomcat v. 4.1.27
J2SE/JDK v. 1.3.1
MySQL Server v. 4.0.17
MySQL Connector/J v. 3.0.10
Below is the content of AUTOEXEC.BAT:
From MySQL Server, I've created the database wordgames with tables (word, wordcategory & wordhint) under it.
Below is the deployment descriptor (web.xml)and is located in the deployment path, c:\Tomcat\webapps\database\WEB-INF:
Java files below are located at the development path, c:\ServletDevel\database\sl314\domain:
ScrambleGameService.java
Word.java
WordCategory.java
WordCategoryDAO.java
WordCategoryService.java
WordDAO.java
Files above were compiled successful and class files of each is copied in the deployment path, c:\Tomcat\webapps\database\WEB-INF\classes\sl314\domain
Below is the code for ScrambleGameService.java:
Below is the code for Word.java:
Below is the code for WordCategory.java:
Below is the code for WordCategoryDAO.java:
Below is the code for WordCategoryService.java:
Below is the code for WordDAO.java:
NamingService.java is located at the development path, c:\ServletDevel\database\sl314\util:
NamingService.java is compiled successful and its class file is copied in the deployment path, c:\Tomcat\webapps\database\WEB-INF\classes\sl314\util
Below is the code for NamingService.java:
Java files below are located at the development path, c:\ServletDevel\database\sl314\web:
InitializeConnectionPool.java
ScrambleGameServlet.java
Files above were compiled successful and class files of each is copied in the deployment path, c:\Tomcat\webapps\database\WEB-INF\classes\sl314\web
Below is the code for InitializeConnectionPool.java:
Below is the code for ScrambleGameServlet.java:
When I entered the URL,
http://localhost:8080/database/ for the message form in the Address field, the page for the URL,
http://localhost:8080/database/index.html is displayed, looks like below:
Duke's Arcade Select from one of the following games:
Word Scramble
Word Guess
Then I selected the Word Scramble link, but errors below is displayed:
Can anybody there help? What do errors above mean? How will I correct those errors? Any suggestions would be greatly appreciated. Thanks in advance.
Cathy
[ February 22, 2004: Message edited by: Cathy Valdez ]