Program to Pass Parameter To Applets using Param Tag

import java.awt.*;

import java.applet.*;

public class HelloJavaParam extends Applet

{

String str;

public void init()

{

str=getParameter(“String”);

if(str==null)

str=”java”;

str=”hello”+str;

}

 public void paint(Graphics g)

{

g.drawString(str,10,100);

}

}

 

 

 

HTML CODE FOR  HelloJavaParam

 

<html>

<! parameterised html file>

<head>

<title>Welcome to java applets </tittle>

</head>

<body>

<applet code=HelloJavaParam.class

      width=400

      height=200>

<param name=”String” value=”Applet!”>

</applet?

</body>

 

</html>

 


OUTPUT 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s