Home Jsp Simple-jsp-example Applet In Jsp

Related Tutorials


 
 

Share on Google+Share on Google+

Applet In Jsp

Advertisement
In this example we are going to show you how you can use an applet in jsp.

Applet In Jsp

        

In this example we are going to show you how you can use an applet in jsp. Before going deep into this program it is important to understand what is the meaning of an applet. Applets are small programs or applications written in java. These applets are those small programs that runs on web browsers, usually written in java. We can use the applets in jee also. In jee it runs on the context of web application on a client computer. This applet run in a container, which is provided by a browser or by through a plug- in. 

In this program we have made one applet in java. After making an applet in java we are using the applet class in the jsp by using the html tag <APPLET CODE = "JavaApplet.class" WIDTH = 200 HEIGHT = 150></APPLET>. This is one of the way by which can use an applet in jsp.

The code of the program is given below:

 

import java.applet.*;
import java.awt.*;
public class javaApplet extends Applet{
  public void paint(Graphics g){
    g.drawString("Welcome in Java Applet.",40,20);
  }
}

 

<HTML>
<HEAD><title>Applet In Jsp</title>
</HEAD>
<BODY>
<APPLET ALIGN="CENTER" CODE="javaApplet.class" WIDTH="800" HEIGHT="500">
</APPLET>
</BODY>
</HTML>

The output of the program:

Welcome in Java Applet.

Download this example.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 8, 2008

Related Tutorials

Discuss: Applet In Jsp  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com