• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to enable checkbox from value fetched from database

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 17652
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
reply
    Bookmark Topic Watch Topic
  • New Topic