Use Plugin in JSP


In this article I am describing an application showing how to use a <jsp:plugin>. It  is used to display an object, especially an applet or a Bean on the client browser. The <jsp:plugin> element plays or dispays an object, in the client Web browser, using a Java plug-in that is built in to the browser or downloaded from a specified URL. When the JSP file is translated and compiled and Java and sends back an HTML response to the client, the <jsp:plugin> element is replaced by either an <object> or <embed> element, according to the browser version.

To develop this application we use the following steps.

Step 1: Create a New Project.

In this step we select New Project option from file menu.

create new project.jpg

Step 2: Choose Project.

In this step we select web application from Java web option and then click on the next button.

select new web application.jpg

Step 3: Name and Location.

In this step we given it a specific name and set a specific location and click on the next button.

 name and location.jpg

Step 4: Server and Setting.

We select a specific server for this application and click on the next button.

server and setting.jpg

Step 5: Select Framework.

There is no need to select any framework for this application; just click on the finish button.

selectframework.jpg

Step 6: Create jsp file.

We create one jsp file for this application.

create new jsp file.jpg

index.jsp

<HTML>
         <HEAD>

                 <TITLE>Using &ltjsp:plugin&gt In Jsp;</TITLE>
         </HEAD>
                 <BODY
BGCOLOR="cyan">
                    <H1>Using &ltjsp:plugin&gt;</H1>
                    <jsp:plugin type="applet" code="AppletCLass.class"
                      width="400" height="400" >
                    <jsp:fallback>
                      Sorry, &lt;OBJECT&gt; or &lt;EMBED&gt; are not supported by your browser.
                    </jsp:fallback>
                    </jsp:plugin>
                 </BODY>
</HTML>

Step 7:
Compile and Run the application.

Now we compile the application and then run it on the server and find the following output.

Output1

First we will get the following output. After clicking on the click here to download, we will find the next output as.

out1.jpg

Output2

In this output firefox is checking for available plugins.

out2.jpg

Output3

This output provide the information about plugin availability.

out3.jpg

Resources related to this article


Similar Articles