In this document we walk you through all the steps you must take to deploy the sample JSP into TomCat 3.2.3 Servlet Container.
Deploy the example
Copy the provided ExcelCalculatorJSP.html, and ExcelCalculatorExample.jsp files into a local directory that is going to be the target directory of your deployment. These files are included in your jintegra\examples\servlet-com\ServletToExcelCalculator directory when you download J-Integra®.
This section explains how you can run the ExcelCalculatorExample on Jakarta TomCat 3.2.3. Because this example JSP is using jintegra.jar and excel.jar, you need to set the CLASSPATH environment so that the Tomcat Servlet Container will find the classes it needs. You can either create a batch file that sets the CLASSPATH or you can modify TomCat's startup.bat to include your CLASSPATH.
Another issue is the authentication library. On an NT machine, you need to be authenticated in order to have access to a COM object. J-Integra® comes with a native library that authenticates you automatically. The native library is located in jintegra\bin. You must add this path to your PATH environment variable. Again, either you can write a batch file to set this one or modify TomCat's startup.bat to do the job.
Ensure that you have you have installed the J-Integra® license.
Create the deployment directory: Create a directory called ExcelExampleJSP in the webapps directory of your TomCat folder. In the ExcelExampleJSP directory, create two directories named META-INF and WEB-INF. Now you should have a directory structure that looks like this:
Create the XML descriptor: Here is the sample XML descriptor you can use to deploy this example. Save this file as web.xml in the WEB-INF directory. This file is included in your jintegra\examples\servlet-com\ServletToExcelCalculator directory (named web.xml for JSP) when you download J-Integra®.
<?xml version="1.0" encoding="Cp1252"?> <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'> <web-app> <display-name>ExcelCalculatorJSP</display-name> <description>no description</description> <servlet> <servlet-name>ExcelCalculatorJSP</servlet-name> <display-name>ExcelCalculatorJSP</display-name> <description>no description</description> <jsp-file>/ExcelCalculatorExample.jsp</jsp-file> </servlet> <session-config> <session-timeout>30</session-timeout> </session-config> </web-app>
Create a manifest file: Create a file called Manifest.mf (it can be an empty file) and save it in the META-INF directory.
Copy ExcelCalculatorExample.jsp and ExcelCalculatorJSP.html to the ExcelExampleJSP directory.
After you finished putting these files on the correct place, your directory structure looks like this:
Now you need to add this new JSP to server.xml. Go to the conf directory and open server.xml.
Add the following lines at the bottom of server.xml just before
<Context path="/ExcelExample" docBase="webapps/ExcelExample" crossContext="true" debug="0" reloadable="true" trusted="false" > </Context>
Shut down the Tomcat server by issuing this command:
Re-start the servlet container by issuing this command:
Open up your browser and enter http://localhost:8080/ExcelExampleJSP/ExcelCalculatorJSP.html as the URL.
Enter two numbers and click Submit.
For information on setting up the environment for different platforms, see Setting up the environment to run a JSP and/or Servlet file.