This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Passing values between two JSPs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing values between two JSPs" Watch "Passing values between two JSPs" New topic
Author

Passing values between two JSPs

chintu reddy
Greenhorn

Joined: Feb 13, 2010
Posts: 21
I have been banging my head for more than a day now to resolve this issue.. grateful if anyone can offer help... I'm trying to fix a bug in a legacy application in my organization.. in one of the jsp pages..

pag1.jsp



The Servlet1 is calling another Servlet2, which in turn calls Servlet3 to print some code to page1.jsp.. one page1.jsp is compiled html output looks like this..
page1.jsp output..



I need to be able to pass "param" value from page1.jsp to page2.jsp. request.setAttribute is not working. The Servlet class Servlet3 is vendor provided so I cannot set a hidden form variable inside form "yy" to pass it to page2.jsp.

if anyone has a solution please help me, Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

If they are not in the same request you cannot use request scope as each request has its own scope. Have you considered using the session?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
chintu reddy
Greenhorn

Joined: Feb 13, 2010
Posts: 21
Yes I tried using Session and it was working... but was wondering if there will be any other options and also any disadvantages of using sessions...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

This is exactly the type of thing sessions were created for. Why not use the proper tool in the manner that the tool was intended to be used?
 
jQuery in Action, 2nd edition
 
subject: Passing values between two JSPs
 
Similar Threads
Need clarification for jsp:include.
linking jsp pages in a liferay portlet
Include one jsp into another at runtime
Passing parameters between servlets
How to get jsp:param