This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Rendering of HTMLOutputLabel dependant on bean validation constraints in backing bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Rendering of HTMLOutputLabel dependant on bean validation constraints in backing bean" Watch "Rendering of HTMLOutputLabel dependant on bean validation constraints in backing bean" New topic
Author

Rendering of HTMLOutputLabel dependant on bean validation constraints in backing bean

Thomas Tamoniczi
Greenhorn

Joined: Apr 15, 2010
Posts: 6
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Rendering of HTMLOutputLabel dependant on bean validation constraints in backing bean
 
Similar Threads
Which Binding Type Do You Prefer And Why
Render Response phase question
Spring-JSF
using convertor in jsf
execute="@none" not working in ajax