Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

check box with html:checkbox

 
Srinivasa Kadiyala
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can we copy the html:checkbox value using beanutil.properties?

I mean when I get data from a database a flag value 0 or 1 and based on that how can check or uncheck an html:checkbox?

Thanks
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An <html:checkbox> is tied to the property of the ActionForm bean specified in the property attribute. Assuming this property is a boolean, just set it to true to show the checkbox as checked, and set it to false to show the checkbox as unchecked.

If you have a model bean that has a property with the same name, but type integer and showing a 1 or 0, I believe the BeanUtils.copyProperties() method will correctly map this value to the boolean property as either true or false.
 
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!