Pets JSP Sample

This example adopts the very simple pet identification system to Java Server Pages. The source code is in:

Building the Sample

To build the sample:

  1. Build pets.xpl by compiling and linking pets.pro.
  2. Change the pathname in the call to ls.Load to match your webserver (see below).
  3. Build PetsJSPBean.class by compiling PetsJSPBean.java with javac
  4. Organize the files into the proper directories for your JSP/web server software. You will also need to put amzi.dll and amzijni.dll (Windows) or libamzi.so and libamzijni.so (Unix) where the JSP/web server can find it.

Running the Sample

Tomcat

Tomcat generally installs in a directory named Apache Group/Tomcat X.X.

In order to run this servlet under Tomcat (where X.X is replaced by the version of Tomcat you are running, and N.N by the version of Java you are running):

  1. Create a sudirectory in ...Apache Group/Tomcat X.X/webapps named 'amzi' (or use another name like amzi1 if you already have an amzi subdirectory).
  2. Copy the amzi/samples/internet/jsp/pets/WEB-INF subdirectory tree to ...Tomcat X.X/webapps/amzi.
  3. Create a directory named 'pets' under the 'classes' subdirectory resulting in ...Tomcat X.X/webapps/amzi/WEB-INF/classes/pets.
  4. Copy PetsJSPBean.class to ...Tomcat X.X/webapps/amzi/WEB-INF/classes/pets.
  5. Copy pets.xpl to ...Tomcat X.X/webapps/amzi
  6. Copy amzi.dll, amzijni.dll (from amzi/bin) to ...Tomcat X.X/webapps/amzi/WEB-INF/classes. Alternatively, you can load these libraries (and LSXs) explicitly in Java with Runtime.getRuntime().load(libraryPath) or loadLibrary(libraryName).
  7. Copy the entire amzi/ls subdirectory tree (from amzi/lsapis/java20) to ...Tomcat X.X/webapps/amzi/WEB-INF/classes (so you now have the Logic Server .class files in Tomcat X.X/webapps/amzi/WEB-INF/classes/amzi/ls).
  8. Stop and restart Tomcat.
  9. In your browser type, http://localhost:8080/amzi/PetsJSP.jsp. Enter a sound, e.g. 'woof' when prompted.