Marysweety
asked on
Retrieve hidden values in a redirected file
hai EE folks,
i need yr help very urgently.could any one give me a solution to solve my problem.Here is my problem,
i am having 2 jspfiles such as test1 and test2. In test1 i am having some hidden fields.when i redirect from test1 to test2 i should get the hidden values in test2.but i got only null values.b'cos i didn't submit the test1 jsp file.so i couldn't collect the values of test1 in test2
using "request.getParameter" method.without using session or submit the form can i get the test1 values in test2. is there any possible way to collect the information.if so,kindly help me.
regards,
Mary Sweety.
i need yr help very urgently.could any one give me a solution to solve my problem.Here is my problem,
i am having 2 jspfiles such as test1 and test2. In test1 i am having some hidden fields.when i redirect from test1 to test2 i should get the hidden values in test2.but i got only null values.b'cos i didn't submit the test1 jsp file.so i couldn't collect the values of test1 in test2
using "request.getParameter" method.without using session or submit the form can i get the test1 values in test2. is there any possible way to collect the information.if so,kindly help me.
regards,
Mary Sweety.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
besides using URL params you can use session or attach the strings to request.
If you are doing a redirect.. try doing a forward instead.
if you can use a forward() then you can attach the strings to request and retrieve them appropriately like so:
request.setAttribute("attr ibutename" , varname);
and then retrieve it using:
String myStr = (String) request.getAttribute("attr ibutename" );
or use session.
This way you can redirect to wherever and be able to retrieve it without having to construct a lengthy URL.
use this for session:
session.setAttribute("attr ibutename" , varname);
for retrieving
String myStr = (String) session.getAttribute("attr ibutename" );
building URL params can be combersome esp when you have a lot of them b/c you do have to URLEncode them as you append them to the URL.
CJ
If you are doing a redirect.. try doing a forward instead.
if you can use a forward() then you can attach the strings to request and retrieve them appropriately like so:
request.setAttribute("attr
and then retrieve it using:
String myStr = (String) request.getAttribute("attr
or use session.
This way you can redirect to wherever and be able to retrieve it without having to construct a lengthy URL.
use this for session:
session.setAttribute("attr
for retrieving
String myStr = (String) session.getAttribute("attr
building URL params can be combersome esp when you have a lot of them b/c you do have to URLEncode them as you append them to the URL.
CJ
ASKER
could i attach 8 hiddenfields through the redirect url(test2).however the hiddenfield values are dynamic.is it possible to send dynamic values over querystring.if so,could u give me the sample code.
regards,
Mary Sweety.