• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Embed JApplet in JSP code

 
Rakesh Gadre
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to add JApplets in JSP code using jsp lugin tag ?
I have tried that using awt applet, but it does not work with JApplet ?
Rakesh
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "it does not work"?
Could it be that your browser has too old version of the JRE/Java Plugin?
 
Rakesh Gadre
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My syntax goes like this :
JSP code :
<html>
<title> Plugin example </title>
<body bgcolor="white">
<h3> Current time is : </h3>
<jsp lugin type="applet" code="serv.class" jreversion="1.2" width="160" height="150" >
<jsp:fallback>
Plugin tag OBJECT or EMBED not supported by browser.
</jsp:fallback>
</jsp lugin>
<p>
<h4>
<font color=red>
The above applet is loaded using the Java Plugin from a jsp page using the
plugin tag.
</font>
</h4>
</body>
</html>
APPLET CODE :
import javax.swing.*;
import java.awt.*;

public class serv extends JApplet
{
public void init()
{
this.getContentPane().setBackground(Color.yellow);
JButton b = new JButton(new ImageIcon("42.gif"));
this.getContentPane().add(b);
}
}
Now, if I comment last two lines from the applet code i.e. if I remove the button part, I get the output on the brtowser. The background colour changes to yellow. But, If i try to add a button, It keeps on diaplaying the grey screen.
Rakesh
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic