The following components are used to set up Eclipse to work with Tomcat.

Component

Location on my local environment

Eclipse 3.2M5 D:\Project\Eclipse_3.2
Sun Java SDK1.4.2_08 C:\j2sdk1.4.2_08
Tomcat 4.1.x D:\Project\Tomcat
Sysdeo tomcat plugin 3.1.0 D:\Project\Eclipse_3.2\plugins\com.sysdeo.eclipse.tomcat_3.1.0

Set Environment Variables:

JAVA_HOME=C:\j2sdk1.4.2_08
CATALINA_HOME=D:\Project\Tomcat
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet.jar;

Test whether Tomcat works properly:

Go to D:\Project\Tomcat\bin, run startup.bat;
Input URL: http://localhost:8080 in the browser window. If the default Tomcat page appears, then the installation of Tomcat is successful.

Set Eclipse to work with Tomcat:

Go to Window -> Preferences...-> Tomcat:
Set Tomcat version: 4.1.x; Tomcat home: D:\Project\Tomcat; Configuration file: D:\Project\Tomcat\conf\server.xml;

Then go to JVM Setting:
Add -DSTANDALONE and -Djava.awt.headless=true to JVM parameters;
C:\j2sdk1.4.2_08\lib\tools.jar in the Classpath.

Till now, it is able to run Tomcat by clicking the "Start Tomcat" button in Eclipse toolbar.

BACK


JSP

Put the XXX.jsp pages at D:\Project\Tomcat\webapps\examples, then it could be accessed by inputting http://localhost:8080/examples/XXX.jsp in the browser window.

Servlet

1. Add the required *.jar files to D:\Project\Tomcat\webapps\examples\WEB-INF\lib to render charts in your web pages.

All the jar files in the above are available in the BIRT build.

2. Compile XXXServlet.java and ChartModels.java to XXX.class, then copy them to D:\Project\Tomcat\webapps\examples\WEB-INF\classes

3. Add the Servlet to web.xml file ( D:\Project\Tomcat\webapps\examples\WEB-INF\web.xml )

<servlet>
<servlet-name>PreferenceServlet</servlet-name>
<servlet-class>PreferenceServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>PreferenceServlet</servlet-name>
<url-pattern>/PreferenceServlet</url-pattern>
</servlet-mapping>

BACK


To generate a dynamic, revisable chart in your web pages, the required components include a JSP page, a Servlet and a chart model.

JSP

Set action to connect Servlet: <form action="PreferenceServlet" method="POST">
Give values to the selection or input components: <option value="value">XXX</option>

Servlet

1. Set rendering device: PluginSettings ps = PluginSettings.instance( ); IDeviceRenderer idr = ps.getDevice( "dv.SWING" );

2. doGet()

3. Chart image rendering

Chart Model

The chart model is absolutely same with other models in the chart examples plugin.

BACK