In this Example we will discuss that we can include an applet or JavaBeans component in a JSP page by using the jsp:plugin
element.
This will generates the HTML content that will contain the client-browser constructs. In the program we use java class for fetching the result an applet code also.Whenever this will be executed the appropriate output on the web browser.
<jsp:plugin type=”applet” code=”Pluginjsp.class” codebase=”p1″ width = “250” height = “250”>
<jsp:fallback>
<p>Applet can’t be load</p>
</jsp:fallback>
</jsp:plugin>
Pluginjsp.java
import java.applet.*;
import java.awt.*;
import java.util.*;
import java.io.*;
public class Pluginjsp extends Applet
{
public void paint(Graphics gr)
{
Calendar cl = new GregorianCalendar();
String hr = String.valueOf(cl.get(Calendar.HOUR));
String mnt = String.valueOf(cl.get(Calendar.MINUTE));
String scnd = String.valueOf(cl.get(Calendar.SECOND));
gr.drawString(hr + “:” + mnt + “:” + scnd, 20, 30);
}
}