Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Chennai JavaProgrammer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
Stephan Mueller
Ranch Hand
Posts: 50
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic