• Post Reply Bookmark Topic Watch Topic
  • New Topic

using "h:selectBooleanCheckbox" component  RSS feed

 
Joe Greene
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello -
I'm storing a flag/boolean property of a bean as an int (0 or 1) in my db, and want to render it using the <h:selectBooleanCheckbox component. When I try to load the page, of course, I get an error indicating that a boolean is expected, but I've got the property bound to the bean property of type int. Is there an easy way to provide automatic back-and-forth conversion for this property on both rendering and submitting, or will I need to write a custom converter? Thanks for any help.

- Joe
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally I'd deal with the property as a boolean in the bean and depending on your persistence mechanism do the conversion from Java boolean to SQL TINYINT when persisting/updating in your DAO/persistence classes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!