Java Technology Home Page
Downloads, APIs, Documentation
Java Developer Connection
Docs, Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide

A-Z Index

The Source for Java Technology

Deploying applets in Java Plug-in with Java Server Pages (JSP)

Java Server Pages (JSP) is a technology for generating dynamic content in web server or application server. Since Java Server Pages Specification 1.0, it provides support for generating proper Java Plug-in HTML tags. This document provides an overview of the JSP support for Java Plug-in and how it should could be used for deploying applets in Java Plug-in.

<jsp:plugin>

An element <jsp:plugin> was added into JSP specification "to enable a JSP page author to generate HTML that contains the appropriate client browser dependent constructs (OBJECT or EMBED) that will result in the download of the Java Plug-in Software (if required) and subsequent execution of the Applet" (JSP Specification 1.1, Page 70). 

When the JSP is executed, this <jsp:plugin> tag is replaced by either an <OBJECT> or <EMBED> tag, accordingly to the requested browser's user agent, following the Java Plug-in HTML Specification. 

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> tag provide configuration data for the applet itself. The <jsp:param> elements indicate the parameters to the applet. The <jsp:fallback> element indicates the content to be used by the browser if Java Plug-in fails to start.

Depending on the browser connecting to this JSP page, the web server may generate either EMBED/OBJECT tag, according to the browser's user agent.

For example, if Netscape Navigator is used to connect this JSP page, the following EMBED tag will be emitted:

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

For more information about the <jsp:plugin> tag, please consult the Java Server Pages Specification for more details.

Deploying Java Plug-in through JSP

JSP provides an alternative way for deploying applets through Java Plug-in, without converting the HTML pages through HTML Converter. Because of the dynamic nature of JSP, developers will be able to generate HTML page on-the-fly that take advantages of Java Plug-in much easier than before.

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


[ This page was updated: 02-Dec-99 ]

Products & APIs | Developer Connection | Docs & Training | Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
Feedback | Map | A-Z Index

For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright ? 1995-2000 Sun Microsystems, Inc.
All Rights Reserved. Terms of Use. Privacy Policy.