Call an applet through a JSP site

2.4k views Asked by At

I have create a simple Hello World Applet and I have save the .class file to the server where the JSP site is.

I want help so what I have to write in the JSP Site so whenever through the Browser I open this specific JSP Site this applet also run and show the message Hello world.

The JSP site and the .class file from the applet are at the same root, for example *D:\server\tomcat\test*

and also if someone can explain me what is the appletviewer and if I need something like this in my case?

1

There are 1 answers

7
sanket On

You add an applet to an html page. The jsp page gets compiled and when it runs its spits out html. So in your browser all you will have is html.

So you basically need to embedd you applet to the html that is generated by your jsp page.

I would suggest you to do some research on adding your applet to html. Once you have that, simply append the resulting html code (which has the applet) to your jsp page.

Embed the applet in the file by adding the following applet tag anywhere between the file's tags: In an HTML file: <applet code="org.me.hello.MyApplet" archive="HelloApplet.jar"></applet>

In a JSP file: <applet code="org.me.hello.MyApplet" archive="HelloApplet.jar" width="600" height="480"/>

The jsp will ultimately spit out the html code.