No of visitors who read this post: 362
Type: Question
Author: Luke Kemper
No votes yet

What is the basic syntax of Java Applet and how I can use Applet in my website? The Web site contains SQL But I want to use the Applet on my site.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#

The simplest way to use jsp: plugin is to supply four attributes: type, code, width and height.

You supply a value of applets for the type attributes and use the other attributes in exactly the same
way as with APPLET element, with two exceptions: the names are case sensitive, and single or double
Quotes are always required around the attribute value.

This is the basic syntax of applet

Syntax     <APPLET CODE="one.class" WIDTH=205 HEIGHT=300></APPLET>
Attribute Specifications     

    CODE=CDATA (class file)
    CODEBASE=URI (base URI for class files)
    WIDTH=Length (applet width)
    HEIGHT=Length (applet height)
    ARCHIVE=CDATA (archive files)
    OBJECT=CDATA (serialized applet)
    NAME=CDATA (name for inter-applet communication)
    ALT=Text (alternate text)
    ALIGN=[ top | middle | bottom | left | right ] (applet alignment)
    HSPACE=Pixels (horizontal gutter)
    VSPACE=Pixels (vertical gutter)
    common attributes

<APPLET CODE="one.class" WIDTH=100 HEIGHT=100>
<PARAM NAME=img1 VALUE="/images/1.jpg">
<PARAM NAME=img2 VALUE="/images/2.jpg">
<IMG SRC="animation.gif" ALT="" WIDTH=100 HEIGHT=100>
</APPLET>

To use your Applet in your website..

just use the jsp plug-in

<jsp:plugin type="applet" code="one.class" codebase="applet" jreversion="1.2" width="160" height="150" >
    <jsp:fallback>
        Plugin tag OBJECT or EMBED not supported by browser.
    </jsp:fallback>
</jsp:plugin>

another example to use plug-in...

<jsp:plugin align="middle" height="500" width="500" type="applet"

        code="one.class"  name="clock"

         codebase="E:\JavaProNetBeens\JSPProject\web"/>

The jsp:plug-in element has a number of other optional attributes.

In this way you can use the Applet plug-in in your website.