1. You have installed tomcat to the TOMCAT_HOME directory
2. Your Visual Café is already using JDK1.2.X
1. Your Visual Café project directory should be of the following structure:
<project topdir>
- html files, image files etc
- <web-inf>
- web.xml
- <classes>
- Visual Project file
- Class files
Your top level project directory should contain your html files and a sub directory named <web-inf>. The <web-inf> directory will contain a web.xml file, and a subdirectory <classes>. Create your Visual Café project file in the <classes> subdirectory, which will contain all other .java and .class files you created in your Visual Café project.
2. Add the following jar files to your Visual Café project Project->Options->Directories->Input Class files:
- All the jar files in the <TOMCAT_HOME>\lib directory
3. Use the following as your projects Main startup class:
org.apache.tomcat.startup.Tomcat
with the following Program Arguments:
-f <TOMCAT_HOME>\conf\server.xml
4. Modify your Visual Café internal jdk to execute your project with the following java startup option:
-Dtomcat.home=”<TOMCAT_HOME>”
For Visual Café 3.0, you can add this option at: Tools->Environment Options->Virtual Machines->Use VM:jdk1.2.2->Other command options
Next, you need to configure Tomcat to point to your project:
5. Edit <TOMCAT_HOME>\conf\server.xml. Add in the following entry:
<Context path=”/projectname”
docbase=”absolute
path to project topdir”
crossContext=”false”
debug=”0”
reloadable=”true”
>
</Context>
6. Edit <project topdir>\web-inf\web.xml.
1. Configure your servlet properties here. You need to give your servlet a servlet name and the init parameters if you’re using them.
2. Give your servlet a mapping.
You can use the web.xml in <TOMCAT_HOME>\webapps\examples\web-inf directory as a reference on how to configure your servlet.
Done!
You can now run your Visual Café project and access your servlet as:
http://localhost:8080/projectname/servlet/servletname
where projectname is that you specified in server.xml, and servletname is that you specified in web.xml
(You can change this URL by modifying the mappings server.xml and web.xml. Details is left to you as an exercise)