You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Adams <ja...@ucar.edu> on 2001/10/02 22:24:45 UTC

How to get an Applet to run in a JSP ?

I have an applet which runs fine when I include it in a HTML page, but
whenever I try to include it in a JSP I get a pop-up message from my
browser (Netscape 4.78) telling me that I need to download the Java
plugin. I get the same behavior when testing with Internet Explorer.
Obviously I already have the plugin or else I wouldn't be able to see
the applet from the HTML page, or is this a mistaken assumption ?

I am using Tomcat 3.2.1 and Apache 1.3.19.

The HTML looks like this:

------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Data Selection</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<form name="main_form" method="post" action="mailto:jadams@ucar.edu">

<b><h3>Select Lat/Lon Region:</h3></b>

<table border=1>
<tr>
<td>
<applet CODE="LiveMap_30.class"
ARCHIVE="LiveMap_30.jar"
NAME="map"
MAYSCRIPT
WIDTH=500
HEIGHT=160>
<param name=base_image  value="gifs/java_0_world_20k.jpg">
<param name=img_x_domain value="-180 180">
<param name=img_y_domain value="-90 90">
<param name=toolType value="XY">
<param name=tool_x_range value="-180 180">
<param name=tool_y_range value="-90 90">
</applet>
</td>
</tr>
</table>
<input type="hidden" name="min_lat" value="">
<input type="hidden" name="max_lat" value="">
<input type="hidden" name="min_lon" value="">
<input type="hidden" name="max_lon" value="">
<p>
<input type="submit" name="Process Request" value="Process Request">
</p>
</form>
</body>
</html>
----------------------


The JSP looks like this:

----------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Data Selection</title>
</head>
<body>
<form name="main_form" method="post" action="mailto:jadams@ucar.edu">
<b><h3>Select Lat/Lon Region:</h3></b>
<jsp:plugin type="applet"
code="/WEB-INF/classes/LiveMap_30.class"
archive="/WEB-INF/lib/LiveMap_30.jar"
name="map"
width="500"
height="160">
<jsp:params>
<jsp:param name="base_image"
value="/WEB-INF/images/java_0_world_20k.jpg"/>
<jsp:param name="img_x_domain" value="-180 180"/>
<jsp:param name="img_y_domain" value="-90 90"/>
<jsp:param name="toolType" value="XY"/>
<jsp:param name="tool_x_range" value="-180 180"/>
<jsp:param name="tool_y_range" value="-90 90"/>
<jsp:param name="mayscript" value="true"/>
</jsp:params>
</jsp:plugin>
<input type="hidden" name="minLat" value="" >
<input type="hidden" name="maxLat" value="" >
<input type="hidden" name="minLon" value="" >
<input type="hidden" name="maxLon" value="" >
<br>
<p>
<input type="submit" name="Process Request" value="Process Request">
</p>
</form>
</body>
</html>
--------------------------------------


Is it possible that I have to include some entries in my
$TOMCAT_HOME/WEB-INF/web.xml file so that Tomcat will know about the
applet, something like

<applet>
    <applet-name>LiveMap</applet-name>
    <applet-class>/WEB-INF/classes/LiveMap_30.class</applet-class>
</applet>


The code for this applet is at
http://tmap.pmel.noaa.gov/~callahan/JAVA/map_v3.0/LiveMap_30.java


Any ideas or suggestions will be very appreciated.


-James