A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
JSP
Author
how to retrieve data into radiobuttons
SEEMANT SRIVASTAVA
Greenhorn
Joined: May 21, 2007
Posts: 1
posted
May 24, 2007 02:19:00
0
I want to check or uncheck radiobuttons according to the value retrieved from databse in jsp.
Ex. two radiobuttons showing Yes and No
After retrieving a value of 'yes' from database , i want to check Yes radiobutton and vice versa.
karthick swami
Greenhorn
Joined: May 14, 2007
Posts: 4
posted
May 24, 2007 04:26:00
0
There will be a property for the radio button.
This property has to be set with the appropriate value taken from DB.
Depending on the radio button property the radio button in the form can be checked or not.
eg.<INPUT TYPE=RADIO NAME="propertyName" VALUE="yes"
<% if (user.getProperty()=="yes") { %>
checked="checked" %> } %>
>YES
</INPUT>
<INPUT TYPE=RADIO NAME="propertyName" VALUE="no"
<% if (user.getProperty()=="no") { %>
checked="checked" %> } %>
>NO</INPUT>
Instead of this scriplets logic:if can also be used to check the value of the property.
[ May 24, 2007: Message edited by: karthick swami ]
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: how to retrieve data into radiobuttons
Similar Threads
radiobutton selection
How can i insert JRadioButton to Cell in JTable
Use of RandomAccessFile class under Swing
CheckBoxes and RadioButtons
Last question for today-->Radio button
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter