File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to enable checkbox from value fetched from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to enable checkbox from value fetched from database" Watch "How to enable checkbox from value fetched from database" New topic
Author

How to enable checkbox from value fetched from database

Pandurang Patil
Greenhorn

Joined: Feb 25, 2003
Posts: 8
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

Joined: Feb 26, 2001
Posts: 5288
    
  10

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
Pandurang Patil
Greenhorn

Joined: Feb 25, 2003
Posts: 8
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 .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to enable checkbox from value fetched from database