Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Embed JApplet in JSP code

 
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
 
author
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
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic