Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to enable checkbox from value fetched from database

 
Pandurang Patil
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
how can i enable the checkbox as checked or unchecked based on the value i get from database.
this is urgent pl any help.
Pandurang
 
Junilu Lacar
Bartender
Pie
Posts: 8887
81
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the underlying property is a boolean, you simply need
<html:checkbox property="urgent" />
If you want to use String values, use multibox
<html:multibox property="urgent" value="very" />
<html:multibox property="urgent" value="notvery" />
<html:multibox property="urgent" value="notatall" />
You'll also need to override the ActionForm's reset() method to set any properties related to checkboxes to their "unchecked" state.
 
Pandurang Patil
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
boolean bnCheckbox = true;// this is the value i get from my data base.if true then checkbox should be clicked.

Formbean.setCheckbox(bnCheckbox);// now i set the value of checkbox to form bean.
//now using the above value i want to display my checkbox as checked what code should i write
after this struts tag
<html:checkbox
if any one can help me in this sample .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic