Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
12.3 Including Applets for the Java Plug In
275
The
jsp:plugin
element instructs the server to build a tag appropriate for
applets that use the plug in. Servers are permitted some leeway in exactly how
they implement this support, but most simply include both
OBJECT
and
EMBED
.
The jsp:plugin Element
The simplest way to use
jsp:plugin
is to supply four attributes:
type
,
code
,
width
, and
height
. You supply a value of
applet
for the
type
attribute and
use the other three attributes in exactly the same way as with the
APPLET
ele
ment, with two exceptions: the attribute names are case sensitive, and single
or double quotes are always required around the attribute values. So, for
example, you could replace
WIDTH=475 HEIGHT=350>
with
code="MyApplet.class"
width="475" height="350">
The
jsp:plugin
element has a number of other optional attributes. Most,
but not all, parallel attributes of the
APPLET
element. Here is a full list.
type
For applets, this attribute should have a value of
applet
.
However, the Java Plug In also permits you to embed JavaBeans
elements in Web pages. Use a value of
bean
in such a case.
code
This attribute is used identically to the
CODE
attribute of
APPLET
, specifying the top level applet class file that extends
Applet
or
JApplet
. Just remember that the name
code
must
be lower case with
jsp:plugin
(since it follows XML syntax),
whereas with
APPLET
, case did not matter (since HTML
attribute names are never case sensitive).
width
This attribute is used identically to the
WIDTH
attribute of
APPLET
, specifying the width in pixels to be reserved for the
applet. Just remember that you must enclose the value in single
or double quotes.
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved