Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Dynamically pass values from one jsp to another

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 164
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do it via session or by doing request.setAttribute
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 69
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if any textbox don't have name
then you cant get or set the jsp page values at all.
 
Ranch Hand
Posts: 98
MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.




 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic