Tuesday, July 15, 2008

Jsp:plugin

Executes an applet or Bean and, if necessary, downloads a Java plug-in to execute it.

Syntax

type="bean | applet"
code="classFileName"
codebase="classFileDirectoryName"
[ name="instanceName" ]
[ archive="URIToArchive, ..." ]
[ align="bottom | top | middle | left | right" ]
[ height="displayPixels" ]
[ width="displayPixels" ]
[ hspace="leftRightPixels" ]
[ vspace="topBottomPixels" ]
[ jreversion="JREVersionNumber | 1.1" ]
[ nspluginurl="URLToPlugin" ]
[ iepluginurl="URLToPlugin" ] >

[
[ <-jsp:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+
]

[ text message for user ]



Example






Unable to load applet





Description

The element plays or dispays 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 file is translated and compiled and Java and sends back an HTML response to the client, the element is replaced by either an <-object> or <-embed> element, according to the browser version. The element is defined in HTML 4.0 and in HTML 3.2.

In general, the attributes to the 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 bean or applet, as this attribute has no default value.
# code="classFileName"

The name of the Java class file the plug-in will execute. You must include the .class extension in the name. The file you specify should be in the directory named in the codebase attribute.
# 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 file that calls is used.
# 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 file 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.
# 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 file where the element appears. The allowed values for align are listed below:

* bottom - Aligns the bottom of the image with the baseline of the text line.

* top - Aligns the top of the image with the top of the text line.

* middle - Aligns the vertical center of the image with the baseline of the text line.

* left - Floats the image to the left margin and flows text along the image's right side.

* right - Floats the image to the right margin and flows text along the image's left side.

# height="displayPixels" width="displayPixels"

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.1"

The version of the Java Runtime Environment (JRE) the applet or Bean requires. The default value is 1.1.
# 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:param name="parameterName" value="{parameterValue | <%= expression %>}" /> ]+

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 element within the element.

The name attribute specifies the parameter name and takes a case-sensitive literal string. The value attribute specifies the parameter value and takes either a case-sensitive literal string or an expression that is evaluated at runtime.

If the dynamic file you are passing the parameter to is an applet, it reads the parameter with the java.applet.Applet.getParameter method.
# text message for user

A text message to display for the user if the plug-in cannot be started. If the plug-in starts but the applet or Bean does not, the plug-in usually displays a popup window explaining the error to the user.

No comments: