wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to set a radio button selected from a JSP page, with the help of values extracted from database? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to set a radio button selected from a JSP page, with the help of values extracted from database?" Watch "How to set a radio button selected from a JSP page, with the help of values extracted from database?" New topic
Author

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

Chennai JavaProgrammer
Greenhorn

Joined: Dec 04, 2011
Posts: 1
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

Joined: May 05, 2010
Posts: 50
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


1. Make it run - 2. Make it run correctly - 3. Make it pretty OR fast/small - 4. ??? - 5. Profit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set a radio button selected from a JSP page, with the help of values extracted from database?
 
Similar Threads
JSP code to complete a task
struts html checkbox and radio
crating a table using JSP
can any one write this JSP program pls
how to call a jsp function with in a hyperlink