Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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
Marshal
Posts: 10380
123
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac 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 .
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!