• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

using "h:selectBooleanCheckbox" component

 
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
 
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.
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic