Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Displaying applet in JSP


The jsp:plugin action tag is used to embed applet in the jsp file. The jsp:plugin action tag downloads plugin at client side to execute an applet or bean.

 

Syntax of jsp:plugin action tag

  1. <jsp:plugin type“applet | bean” code“nameOfClassFile”
  2. codebase“directoryNameOfClassFile”
  3. </jsp:plugin>

 

Example of displaying applet in JSP

 

In this example, we are simply displaying applet in jsp using the jsp:plugin tag. You must have MouseDrag.class file (an applet class file) in the current folder where jsp file resides. You may simply download this program that contains index.jsp, MouseDrag.java and MouseDrag.class files to run this application.

 

index.jsp

  1. <html>
  2.     <head>
  3.         <meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8”>
  4.         <title>Mouse Drag</title>
  5.     </head>
  6.     <body bgcolor=“khaki”>
  7. <h1>Mouse Drag Example</h1>
  8.  <jsp:plugin align=“middle” height=“500” width=“500”
  9.      type=“applet”  code=“MouseDrag.class” name=“clock” codebase=“.”/>
  10.     </body>
  11. </html>

Comments

comments