Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you pass a parameter from one jsp page to another?

Status
Not open for further replies.

samvonac

Programmer
May 18, 2001
8
US
Hi,

I have two jsp pages and I want to pass parameters from one to another. I was using response.sendRedirect("myjsp.jsp?Parameters") and this works fine. However... if the length of the parameter is very long (ie, thousands of characters) this method does not work. Is there another way of passing parameters that can handle large sizes of data?

Thanks.
-td
 
Use POST requests instead of querystring (GET requests). This requires you to create an HTML form and submit it to a page.
Example HTML form:
Code:
<form method=&quot;POST&quot; action=&quot;/mypage.jsp&quot;>
  <input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;34&quot;>
  <input type=&quot;text&quot; name=&quot;user&quot;>
  <input type=&quot;submit&quot;>
</form>
This will create a simple HTML form that will submit the parameters id and name to the specified jsp page. You will access these parameters in exactly the same way as you do currently with GET requests. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top