[an error occurred while processing this directive]

JSP Plugin

                          

Syntax: <jsp: plugin type = "bean |applet" code = "ClassFileName" codeBase = "ClassFileDirectoryName">

The <jsp:plugin> is used to display an object, especially an applet or a Bean on the client browser. When the Jsp file is translated and compiled, the <jsp:plugin> is replaced by either an <object> or <embed> element, it is based on the browser version. 

Some of the attributes of <jsp: plugin> are defined below:

type = "bean |applet" :- This type of object will be executed by the plug-in. It must be either bean or an applet.

code = "ClassFileName" :- It is the name of the java class file which will be executed by the plug-in. The use .class extension is a must.

codebase = "ClassFileDirectoryName" :- It is the name of the directory that contains the java class file, that will be executed by the plug-in.

The code of the program is given below:

 

import java.applet.*;
import java.awt.*;
      
//<applet code = JavaApplet width = 300 height = 300></applet>
public class JavaApplet extends Applet{
  public void paint(Graphics g){
    g.drawString("Welcome in Java Applet.",40,20);
  }
}

 

<jsp:plugin type="applet" code="JavaApplet" codebase=
 "/tapan/jsp/jspexamples" width = "200" height = "200">
	<jsp:fallback>
		<p>Unable to load applet</p>
	</jsp:fallback>
</jsp:plugin>

The output of the program is given below:

Download this example.

                          

[an error occurred while processing this directive]