<Jsp:plugin> tag:-
-------------------
This tag is useful to display an applet on browser window. This tag internally uses <embed>, <object> tags of html to display applet on browser window.
Syntax:-
<jsp:plugin attributes>
<jsp:fallback>
msg to be printed when browser doesn’t support applets
</jsp:fallback>
</jsp:plugin>
Attributes:-
Type=”applet/bean”
Code=”TestApp.class” the class acting as Applet
Code base=”directory where above .class file available”
Width=”in pixels”
Height=”in pixels”
This tag is outdated because using applet in html page makes browser to take lot of time to display that html page on browser window. Initially applets are given as alternate for html forms but because of their bad performance, programmers are not preferring to designing forms in the form of applets.
TestApp.java
import java.applet.*;
import java.awt.*;
public class TestApp extends Applet
{
Public void paint(Graphics g)
{
SetBackground (color.red);
g.drawString(“hello”,50,50);
add(new Button(“ok”));
SetVisible(true);
}
}
Plug.jsp
<html>
<body bgcolor=”pink”>
<jsp:plugin type=”applet” code=”TestApp.class” codebase=”/jsp-plug” width=”300” height=”300”>
<jsp:fallback>
Plug in tag (or) OBJECT (or) EMBED tag are not supported by browser
</jsp:fallback>
</jsp:plugin>
</body>
</html>