• 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

How to set a radio button selected from a JSP page, with the help of values extracted from database?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Please help me in solving this problem.

I have a jsp page to add new employee. In which you have a radio button to select the employee's gender. I have another page called update employee details. In this page, when you enter the unique ID of the employee, a form appears as same as the form which you used for adding employee with all the details (obtained from database) of the employee of that Unique ID. Then, you can edit the employee details and update here. In this page, I am able to retrieve the all the values from database in text boxes but I don't know how to set a radio button checked/how to set the value of a dropdown box from the database values in JSP.

Please help me. JavaRanch is my only hope.

Note: please provide codes for both radio button and dropdown issue.
 
Ranch Hand
Posts: 50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's more of a JSP question. To be more specific, it's a HTML question.
If you read up on the input-TAG, you'll find the "checked" attribute.

So you'll generate a conditional expression using JSP to create the input tag with a checked attribute according to the value of your object's gender.

The result for the checked button looks like
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic