File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Embed JApplet in JSP code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Embed JApplet in JSP code" Watch "Embed JApplet in JSP code" New topic
Author

Embed JApplet in JSP code

Rakesh Gadre
Ranch Hand

Joined: Feb 22, 2003
Posts: 47
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
What do you mean by "it does not work"?
Could it be that your browser has too old version of the JRE/Java Plugin?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Rakesh Gadre
Ranch Hand

Joined: Feb 22, 2003
Posts: 47
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Embed JApplet in JSP code