<jsp:plugin>
Causes the execution of an applet or bean. The applet or bean executes in the specified plugin. If the plugin is not available, displays a dialog to initiate the download of the plugin software.
JSP Syntax
<jsp:plugintype="bean|applet"code="classFileName"codebase="classFileDirectoryName"[ name="instanceName" ][ archive="URIToArchive, ..." ][ align="bottom|top|middle|left|right" ][ height="{displayPixels| <%= expression %>}"][ width="{displayPixels| <%= expression %>}"][ hspace="leftRightPixels" ][ vspace="topBottomPixels" ][ jreversion="JREVersionNumber|1.2" ][ nspluginurl="URLToPlugin" ][ iepluginurl="URLToPlugin" ] >[ <jsp:params>[ <jsp:param name="parameterName" value="{parameterValue| '${' Expression '}' | <%=expression%>}" /> ]+</jsp:params> ][ <jsp:fallback>text message if plugin download fails</jsp:fallback> ]</jsp:plugin>
XML Syntax
<jsp:plugin
type="bean|applet" code="classFileName"
codebase="classFileDirectoryName"
[ name="instanceName" ] [ archive="URIToArchive, ..." ]
[ align="bottom|top|middle|left|right" ]
[ height="{displayPixels | '${' Expression '}' | %= expression %}" ]
[ width="{displayPixels | '${' Expression '}' | %= expression %}"]
[ hspace="leftRightPixels" ] [ vspace="topBottomPixels" ]
[ jreversion="JREVersionNumber | 1.2" ]
[ nspluginurl="URLToPlugin" ]
[ iepluginurl="URLToPlugin" ] >
[ <jsp:params>
[ <jsp:param name="parameterName"
value="{parameterValue | '${' Expression '}' |
%= expression %}" /> ]+
</jsp:params> ]
[ <jsp:fallback> text message if plugin download fails
</jsp:fallback> ]
</jsp:plugin>
Examples
<jsp:plugin type=applet code="Molecule.class" codebase="/html"> <jsp:params> <jsp:param name="molecule" value="molecules/benzene.mol" /> </jsp:params> <jsp:fallback> <p>Unable to load applet</p> </jsp:fallback> </jsp:plugin>
Description
The jsp:plugin element plays or displays an object (typically an applet or bean) in the client web browser, using a Java plug-in that is built in to the browser or downloaded from a specified URL.
When the JSP page is translated and compiled and Java and sends back an HTML response to the client, the jsp:plugin element is replaced by either an <object> or <embed> element, according to the browser version. The <object> element is defined in HTML 4.0 and <embed> in HTML 3.2.
In general, the attributes to the jsp:plugin element specify whether the object is a bean or an applet, locate the code that will be run, position the object in the browser window, specify an URL from which to download the plug-in software, and pass parameter names and values to the object. The attributes are described in detail in the next section.
Attributes
type="bean|applet"- The type of object the plug-in will execute. You must specify either
beanorapplet, as this attribute has no default value.
- The type of object the plug-in will execute. You must specify either
code="classFileName"- The name of the Java class file the plug-in will execute. You must include the
.classextension in the name. The class file you specify should be in the directory named in thecodebaseattribute.
- The name of the Java class file the plug-in will execute. You must include the
codebase="classFileDirectoryName"- The directory (or path to the directory) that contains the Java class file the plug-in will execute. If you do not supply a value, the path of the JSP page that calls
jsp:pluginis used.
- The directory (or path to the directory) that contains the Java class file the plug-in will execute. If you do not supply a value, the path of the JSP page that calls
name="instanceName"- A name for the instance of the bean or applet, which makes it possible for applets or Beans called by the same JSP page to communicate with each other.
- A name for the instance of the bean or applet, which makes it possible for applets or Beans called by the same JSP page to communicate with each other.
archive="URIToArchive, ..."- A comma-separated list of pathnames that locate archive files that will be preloaded with a class loader located in the directory named in
codebase. The archive files are loaded securely, often over a network, and typically improve the applet's performance.
- A comma-separated list of pathnames that locate archive files that will be preloaded with a class loader located in the directory named in
align="bottom|top|middle|left|right"- The position of the image, object, or applet. The position descriptions listed below use the term text line to mean the line in the viewable JSP page that corresponds to the line in the JSP page where the
jsp:pluginelement appears. The allowed values foralignare listed below:bottomAligns the bottom of the image with the baseline of the text line.topAligns the top of the image with the top of the text line.middleAligns the vertical center of the image with the baseline of the text line.leftFloats the image to the left margin and flows text along the image's right side.rightFloats the image to the right margin and flows text along the image's left side.
- The position of the image, object, or applet. The position descriptions listed below use the term text line to mean the line in the viewable JSP page that corresponds to the line in the JSP page where the
height="{displayPixels| <%= expression %>}" width="{displayPixels | <%= expression %>}"- The initial height and width, in pixels, of the image the applet or bean displays, not counting any windows or dialog boxes the applet or bean brings up.
- The initial height and width, in pixels, of the image the applet or bean displays, not counting any windows or dialog boxes the applet or bean brings up.
hspace="leftRightPixels" vspace="topBottomPixels"- The amount of space, in pixels, to the left and right (or top and bottom) of the image the applet or bean displays. The value must be a nonzero number. Note that hspace creates space to both the left and right and vspace creates space to both the top and bottom.
jreversion="JREVersionNumber | 1.2"- The version of the Java Runtime Environment (JRE) the applet or bean requires. The default value is 1.2.
nspluginurl="URLToPlugin"- The URL where the user can download the JRE plug-in for Netscape Navigator. The value is a full URL, with a protocol name, optional port number, and domain name.
iepluginurl="URLToPlugin"- The URL where the user can download the JRE plug-in for Internet Explorer. The value is a full URL, with a protocol name, optional port number, and domain name.
<jsp:params> [ <jsp:param name="parameterName"
value="{parameterValue | <%= expression %>}" /> ]+ </jsp:params>- The parameters and values that you want to pass to the applet or bean. To specify more than one parameter value, you can use more than one
jsp:paramelement within thejsp:paramselement. Thenameattribute specifies the parameter name and takes a case-sensitive literal string. Thevalueattribute specifies the parameter value and takes either a case-sensitive literal string or an expression that is evaluated at runtime. If the dynamic resource you are passing the parameter to is an applet, it reads the parameter with thejava.applet.Applet.getParametermethod.
<jsp:fallback>text message for user</jsp:fallback>- The amount of space, in pixels, to the left and right (or top and bottom) of the image the applet or bean displays. The value must be a nonzero number. Note that hspace creates space to both the left and right and vspace creates space to both the top and bottom.
See Also
- The HTML 3.2 specification: http://www.w3.org/TR/REC-html32.html
- The HTML 4.0 specification: http://www.w3.org/TR/REC-html40/
