I have developed a JSP webapplication with an Applet. I am not able to display the applet from my JSP page.
Below is the code:
<applet codebase="http://localhost:8080/av_applet_jsp/applets" code="av_app.class" WIDTH="200" HEIGHT="100">
av_app.class
is located inside Webcontent/applets/
Where I am going wrong?
Here is my applet class:
public class av_app extends Applet {
@Override
public void paint(Graphics g) {
int inset;
int rectWidth, rectHeight;
g.setColor(Color.pink);
g.fillRect(0,0,300,160);
g.setColor(Color.green);
inset = 0;
rectWidth = 299;
rectHeight = 159;
while (rectWidth >= 0 && rectHeight >= 0) {
g.drawRect(inset, inset, rectWidth, rectHeight);
inset += 15;
rectWidth -= 30;
rectHeight -= 30;
}
}
}
I am able to see applet using applet viewer. What I am doing wrong in my JSP page?
When I tried an example code it's working:
<applet codebase="http://java.sun.com/applets/NervousText/1.1"
code="NervousText.class" width=400 height=75>
<param name="text" value="Welcome to HotJava!">
</applet>