| Author |
Dynamically pass values from one jsp to another
|
nancy andrew
Ranch Hand
Joined: Jan 19, 2010
Posts: 30
|
|
Hi All,
Recently i came across a question. Suppose there are two different jsp pages namely a1.jsp and a2.jsp
a1.jsp contains some text dynamically loaded text fields:
Emp Name
Age
Salary
When we sumbit this page, then the output should be printed in a2.jsp
This would have been easier. But there is a condition that suppose name and id of the text box are not be used anywhere. Please answer this.
|
 |
Vinoth Thirunavukarasu
Ranch Hand
Joined: Dec 18, 2008
Posts: 164
|
|
|
You can do it via session or by doing request.setAttribute
|
Java Best Practices
Linux Best Practices
Amortization Calculator
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56218
|
|
|
I'm not sure I understand the question, but it sounds pretty silly and contrived. Was this an interview question?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
mahesh shinde
Ranch Hand
Joined: Jul 24, 2009
Posts: 69
|
|
if any textbox don't have name
then you cant get or set the jsp page values at all.
|
 |
aruna sydu
Ranch Hand
Joined: Jan 21, 2008
Posts: 98
|
|
nancy andrew wrote:Hi All,
Recently i came across a question. Suppose there are two different jsp pages namely a1.jsp and a2.jsp
a1.jsp contains some text dynamically loaded text fields:
Emp Name
Age
Salary
When we sumbit this page, then the output should be printed in a2.jsp
This would have been easier. But there is a condition that suppose name and id of the text box are not be used anywhere. Please answer this.
Hi Nancy,
1.When you are submitting a1.jsp suppose using javascript form.submit to the a2.jsp assuming that the
Emp Name
Age
Salary are present in the form.
All the form parameters are populated into the request object.
2.In the a2.jsp You can use request.getParameterNames() and request.getParameterValues() to get the list of form names and their values without refering to the textbox names or Id.
Hope this helps..
Aruna.
|
Attitude Determines Altitude
SCJP4/SCWCD4/SCDJWS5/Preparing SCEA Part I
|
 |
 |
|
|
subject: Dynamically pass values from one jsp to another
|
|
|