Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Retrieve hidden values in a redirected file

Posted on 2002-06-26
3
Medium Priority
?
278 Views
Last Modified: 2010-04-01
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.
0
Comment
Question by:Marysweety
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
kotan earned 150 total points
ID: 7112919
When redirect from test1 to test2, attach the hidden value to the redirect url by javascript.

Example:

url=http://aaa/test2.jsp?hiddenfield=value

Then you can get the value by request.getParameter("hiddenfield");

0
 

Author Comment

by:Marysweety
ID: 7113060
hai kotan,

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.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7113611
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("attributename", varname);

and then retrieve it using:
String myStr = (String) request.getAttribute("attributename");

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("attributename", varname);

for retrieving
String myStr = (String) session.getAttribute("attributename");

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
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While opting for any web-to-print solution, you need to discuss with your team and some of your end users and know their opinions about your decisions. In this article we list down some questions you need to ask yourself.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question