aspose file tools*
The moose likes JSP and the fly likes Dynamically pass values from one jsp to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Dynamically pass values from one jsp to another" Watch "Dynamically pass values from one jsp to another" New topic
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: 61066
    
  66

I'm not sure I understand the question, but it sounds pretty silly and contrived. Was this an interview question?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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