• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Rendering of HTMLOutputLabel dependant on bean validation constraints in backing bean

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I use JSF 2.0 along with bean validation (JSR-303). Some properties in my backing bean are annotated with 'NotNull'-constraint.

I would like to re-use these modell constraints for ui rendering: While rendering my page I would like to add some hint to the text/value of the HTMLOutputLabel, instead of "<property translation>" it should be rendered as "<property translation> (mandatory)" for all required properties (e.g. not only "date of birth" but "date of birth (mandatory)").

I managed to achieve this behaviour with a render-phase-listener in the beforePhase(), but this works only for postbacks. For the initial call the ui tree is not yet created ( I need the tree to find the ui input for the label to find the backing bean's property with it's annotations)!?

Do you have any suggestions how to get this working? Is there a better way than using a phase listener?

Thanks.
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic