Home Tutorial Java Jsp Standard Action "jsp:param"

 
 

Share on Google+Share on Google+
Standard Action "jsp:param"
Posted on: June 19, 2010 at 12:00 AM
Advertisement
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

Advertisement

Related Tags for Standard Action "jsp:param":


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 19, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com