Is it possible to use visual JavaBeans with JSP?

Govind Seshadri

Yes, you should be able to use beans and applets at the presentation layer by making use of the <jsp:plugin> tag.

The plugin action causes the automatic generation of HTML containing either the OBJECT or EMBED tags (depending on the browser type), causing the browser to download and install the Java Plugin software, if it is not already installed on the client machine. The specified beans and applets are then executed within the JRE provided by the Java Plugin.

Consider the following example which executes a pie-chart applet within the JRE of the Java Plugin:

<jsp:plugin type="applet" code="PieChart.class" codebase="/html" >
  <jsp:params>
    <jsp:param name="piechartdata" value="sales/data.dat"/>
  </jsp:params>
 <jsp:fallback>
     unable to start plugin 
  </jsp:fallback>
</jsp:plugin>

If you want to use a bean instead, just specify type="bean" within the <jsp:plugin> tag.

The syntax of the <jsp:plugin> tag is shown below:

<jsp:plugin type="bean|applet"
code=" objectCode"
codebase=" objectCodebase"
{ align=" alignment" }
{ archive=" archiveList" }
{ height=" height" }
{ hspace=" hspace" }
{ jreversion=" jreversion" }
{ name=" componentName" }
{ vspace=" vspace" }
{ width=" width" }
{ nspluginurl=" url" }
{ iepluginurl=" url" } >
{ <jsp:params>
{  <jsp:param name=" paramName" value=" paramValue"  }+
  </jsp:params> }
{ <jsp:fallback> arbitrary_text </jsp:fallback> }
</jsp:plugin>

type Identifies the type of the component; a Bean, or an Applet. code As defined by HTML spec codebase As defined by HTML spec align As defined by HTML spec archive As defined by HTML spec height As defined by HTML spec hspace As defined by HTML spec jreversion Identifies the spec version number of the JRE the component requires in order to operate; the default is: "1.1" name As defined by HTML spec vspace As defined by HTML spec title As defined by the HTML spec width As defined by HTML spec nspluginurl URL where JRE plugin can be downloaded for Netscape Navigator, default is implementation defined iepluginurl URL where JRE plugin can be downloaded for IE, default is implementation defined.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact