• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Prepopulating a jsp

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jsp page which has many fields like text, textarea, drop down, radio button,
First the user enters all the values into this page and goes to some other page, and in this way he continues,but there is a link in on of the pages which brings him back to the first page. when he comes to this page all the filds should be prepopulated.

I made a session, in which i saved all the entered data, and when i come to the first page i am able to get the entered data.And i am able to prepopulate the text fields using value=<%=entereddata%>, but how can i prepopulate a drop down, i mean have a drop down in a selected state
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By adding selected or 'selected="selected" to an option, you can let the browser know that a particular entry has been selected.

 
santu Naid
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The options to be selected is not constant, it changes every now and then,

When a user selects an option, and then leaves the page to go to a new page,
and when he returns to same page again, the drop down should be in a selected state, the same option which he selected before.

while run time...
When i come to this page i have the value of the selected option from the session object , with this value how can i make the drop down to be in selected state with that value dynamically.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Typically it would look something like this:



There are less verbose ways of doing this but I think this is the most explanatory.
[ January 07, 2008: Message edited by: Gregg Bolinger ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic