Testing Initial Servlet Functionality
The first task in testing servlet functionality was to test the ability to run the sample servlets provided with the JSDK kit. This task did not require any HTML forms to be created. In addition, a web server was not needed. A standalone servletrunner application is packaged with JSDK. The servletrunner application listens on port 8080 of the host system for HTTP formatted requests. Upon receiving a HTML request to execute a servlet, the servletrunner application spawns the requested servlet and returns a dynamically created HTML page to the user. Thus, by only using a standard web browser, a servlet could be executed by issuing a standard URL, such as http://host:8080/servlet/servletname.
Once servlets were tested as being functional, the next step was to integrate PWS and servlets. Details of this task can be found in the JRun section. The final test of functionality was to create a HTML form which called a servlet.
Sample Servlets
Following are sample servlets included in the JSDK kit and which were used to test functionality and gain insight as to how servlets are coded. Both .java and .class files are included for each servlet.
Project Servlet Debugging/Testing
A HTML form (aliaslookup.htm) was created which contained a single form field, which when submitted, invoked a Java servlet. The HTML form utilized a POST action, however a GET action could also have been used. A servlet was created which accepted POSTed data fields and then generated a SQL query command. A JDBC:ODBC database connection was opened to the simulated FTS database, and the SQL query was executed. The results of the query were then formatted into a HTML page and returned to the client.
Debugging and testing of the servlet required that the HTML to Servlet data transfer be debugged. Once this was accomplished, the servlet to JDBC:ODBC link had to be tested and debugged. Last of all the database SQL query command syntax had to be learned and debugged.