Home Tutorial Java Jsp Standard Action "jsp:param"

 
 

Standard Action "jsp:param"
Posted on: June 19, 2010 at 12:00 AM
In this Section, we will discuss about "jsp:param" standard action & their utilization with a example.

Standard Action <jsp:param>

In this Section, we will discuss about "jsp:param" standard action & their utilization with a example.

Basically, <jsp:param> is use to pass one or more name/value pairs as request parameters to other resources like JSP page, servlet or other resource that can process the parameter. This tag can be enclose in any other action tags, where passing of parameters is required, for example--<jsp: forward> & <jsp:include>

Syntax:

<jsp:param name="parameterName"
 value="{
parameterValue | <%= expression %>}" />+

The name attribute specifies the parameter name and takes a case-sensitive literal string. The value attribute specifies the parameter value and takes either a case-sensitive literal string or an expression that is evaluated at request time.

EXAMPLE :

In this example we are passing a parameters to a file by using <jsp: forward> tag. Inside this tag we have used the tag <jsp: param>. This tag is used to pass the name and values to the targeted file. These parameters will be retrieved by the targeted file by using "request.getParameter()" method.


jspparam1.jsp

<html>

<head>

<title></title>

</head>

<body>

<jsp:forward page="jspparam2.jsp">

<jsp:param name="myParam" value="ANKIT KAUSHAL"/>

<jsp:param name="Age" value="15"/>

</jsp:forward>

</body>

</html>

 

jspparam2.jsp

This page has 2 forwarded parameters : <br>

<b>Name:</b> <%= request.getParameter("myParam") %><br>

<b>Age:</b> <%= request.getParameter("Age") %>

 

OUTPUT :

Download Source Code

Related Tags for Standard Action "jsp:param":


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.