• Post Reply Bookmark Topic Watch Topic
  • New Topic

Database value to jsp <select> field as selected

 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a page which wud be used for updation of employee detail.
I am retreiving data from database and showing it on the form.
Problem is this some fields is in <select> and <radio> element how to show those retrieved value in these field.
as i am using this for updation i have to keep other selection values too.
* In code datedisplay is split ted string of date from database.

 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do something like this:

If the currently read value from collection(master list of options) is equal to the database value, then that option should be shown as selected.


Similar for radio button.
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Prajakta :)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!