Core java tutorial for beginners
A tutorial blog which explains different core concepts related to Java along with programming examples

March 1, 2016 Categories: Applets. 6 Comments on Passing Parameters to Applets

In this article we will learn about passing parameters to applets using the param tag and retrieving the values of parameters using getParameter method.


Parameters specify extra information that can be passed to an applet from the HTML page. Parameters are specified using the HTML’s param tag.


Param Tag


The <param> tag is a sub tag of the <applet> tag. The <param> tag contains two attributes: name and value which are used to specify the name of the parameter and the value of the parameter respectively. For example, the param tags for passing name and age parameters looks as shown below:


<param name=”name” value=”Ramesh” />
<param name=”age” value=”25″ />


Now, these two parameters can be accessed in the applet program using the getParameter() method of the Applet class.


getParameter() Method


The getParameter() method of the Applet class can be used to retrieve the parameters passed from the HTML page. The syntax of getParameter() method is as follows:


String getParameter(String param-name)


Let’s look at a sample program which demonstrates the <param> HTML tag and the getParameter() method:



Output of the above program is as follows:




Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.


You can follow any responses to this entry through the RSS 2.0 feed.

it is so help full to me thanks.

this code is not working

how to pass an integer value using param …

    In the Java code (class) you can convert a string into integer using Integer.parseInt() method.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up