Developing Web Applications With Ant by Richard Hightower - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

HelloWorld.jsp Applet Delivery

Now the applets JAR we built earlier becomes part of the Web application. It is put in the Web application where the browser can find it. The Web application has a JSP page, HelloApplet.jsp, which has a jsp:plugin tag that delivers the applet to the browser. The HelloApplet.jsp with the jsp:plugin action looks like this:

<html>
<head><title>Hello World Applet</title></head>
<body>
<jsp:plugin type="applet"

code="xptoolkit.applet.HelloWorldApplet"
archive="helloapplet.jar"
height="200"
width="200"
align="center">

<jsp:fallback>
<!-- This fallback message will display if the plugin does not work. /-->
<p> Java is cool. Get a browser that supports the plugin. </ br> Or we will hunt you down and melt your computer! </p>
</jsp:fallback>
</jsp:plugin>
</body>
</html>

 

This shows how the applet is delivered to the browser. How is the applet included in the Web application's WAR file in the first place? We explain in the next section.