JavaServer Pages

This chapter includes the following topics:

JavaServer Pages (JSP) is a technology for generating dynamic web-page content from a web/application server. JSP provides support for Java Plug-in HTML elements. This document tells how to use the JSP Plug-in action element for deploying applets with Java Plug-in.

JSP Java Plug-in Action Element: <jsp:plugin>

The <jsp:plugin> action element enables a JSP page author to generate HTML for downloading the Java Plug-in, if it is not installed, and executing an applet. Specifically the action generates the OBJECT element for Internet Explorer or the EMBED element for Netscape Navigator.

When the JSP is executed, the <jsp:plugin> action element is replaced by either an <OBJECT> or <EMBED> HTML tag, depending on the browser. 

For example, an applet may be specified as follows in JSP:

<jsp:plugin type=applet code="Molecule" codebase="/html" >
<jsp:params>
    <jsp:param name="molecule" value="molecules/benzene.mol"/> 
</jsp:params>
<jsp:fallback>
       <p> Unable to start Plug-in. </p>
</jsp:fallback>
</jsp:plugin>

In the above example, the attributes of the <jsp:plugin> element provide configuration data for the applet itself. The <jsp:param> elements specify the parameters to the applet. The <jsp:fallback> element specifies content for the browser if Java Plug-in fails to start.

Depending on the User Agent requesting the JSP page, the web server will generate either an EMBED or OBJECT tag.

For example, if Netscape Navigator is the User Agent requesting the JSP page, the following EMBED tag will be produced by the server:

<EMBED type="application/x-java-applet" 
        code="Molecule" codebase="/html" molecule="molecules/benzene.mol">
<NOEMBED>
<p> Unable to start plug-in </p>
</NOEMBED>

Note

The above works for Netscape 4, as it supports the EMBED tag, but it does not work for Netscape 6.x, as it currently does not support the EMBED tag.

For more information about the <jsp:plugin> element, see Java Server Pages Specification.

Deploying Java Plug-in through JSP

JSP provides an alternative way to deploy applets through Java Plug-in. Because of the dynamic nature of JSP, developers will be able to generate HTML pages on-the-fly that take advantage of Java Plug-in much more easily than before.

Although <jsp:plugin> tag support is part of the JSP specification, various web or application server vendors may provide different implementations and different levels of controls over this feature. For more information, contact your server vendor.


Oracle and/or its affiliates
Java Technology

Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.

Contact Us