How to read bean validation from a component

122 Views Asked by At

I'm trying to automatically add a '*' to required fields on my JSF pages using a simple phase listener, using uiInputObject.isRequired(), but this seems to work only when the required attribute is explicitly set in the markup as such:

<h:inputText required="true"/>

Is this possible to achieve with JSF-303 bean validation? Note that this information is needed on GET, rather than POST. Example

Model class

@NotNull
private String myField;

Markup

<h:inputText value="#{myBean.myField"/> <!-- required field -->
0

There are 0 best solutions below