File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes how to retrieve data into radiobuttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to retrieve data into radiobuttons" Watch "how to retrieve data into radiobuttons" New topic

how to retrieve data into radiobuttons


Joined: May 21, 2007
Posts: 1
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

Joined: May 14, 2007
Posts: 4
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" %> } %>

<INPUT TYPE=RADIO NAME="propertyName" VALUE="no"
<% if (user.getProperty()=="no") { %>
checked="checked" %> } %>

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:
subject: how to retrieve data into radiobuttons
It's not a secret anymore!