Home Jsp Simple-jsp-example Passing Parameters to Another JSP Page
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Passing Parameters to Another JSP Page

Advertisement
By using the include action we can pass the parameters to another jsp page. We can do this by doing using the . This tag is used as a child tag.

Passing Parameters to Another JSP Page

    

By using the include action we can pass the parameters to another jsp page. We can do this by doing using the <jsp:param>. This tag is used as a child tag. It can temporarily override a request parameter or it can temporarily introduce a new request parameter when calling a jsp page. This param tag can be attached to a query string by adding ?param1=name1&param2=name2 at the last of URL string.

In this program we are retrieving the parameter by using the getParameter("String str"). This method can be used to capture the values in the jsp post from the html form or the jsp page.

 

The code of the program is given below:

 

<html>
    <head></head>
    <body>
    <jsp:include page="RetrievingParameters.jsp" >
        <jsp:param name="name2" value="James" />
        <jsp:param name="name3" value="Bill" />
    </jsp:include>
    Pass the value:
    Name1: <%= request.getParameter("name1") %><br>
    Name2: <%= request.getParameter("name2") %><br>
    Name3: <%= request.getParameter("name3") %><br><br>
   </body>
    </html>

 

 Retriever:
    Name1: <%= request.getParameter("name1") %><br>
    Name2: <%= request.getParameter("name2") %><br>
    Name3: <%= request.getParameter("name3") %><br>

The output of the program is given below:

Download this example

 

Advertisement

Liked it!  Share this Tutorial


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: October 6, 2010

Ask Questions?    Discuss: Passing Parameters to Another JSP Page  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
santhosh
February 21, 2012
Passing Parameter from one page to another

how to pass a collection of parameters from one page to another page in jsp page .
DMCA.com