• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to retrieve data into radiobuttons

 
SEEMANT SRIVASTAVA
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic