File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically pass values from one jsp to another

 
nancy andrew
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 164
Android Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do it via session or by doing request.setAttribute
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand the question, but it sounds pretty silly and contrived. Was this an interview question?
 
mahesh shinde
Ranch Hand
Posts: 69
Eclipse IDE Firefox Browser Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if any textbox don't have name
then you cant get or set the jsp page values at all.
 
aruna sydu
Ranch Hand
Posts: 98
MyEclipse IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.




 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic