During form validation in JSF, by default exception(s) thrown will display the element's client id.
But that is meaningless to the system users, because the client id is not tally with the corresponding element label.
To display a meaningful element name during exception thrown, simply set the label attribute for the input component(s) inside the form will do.
<h:outputLabel for="firstname" value="Firstname: *" />
<p:inputText
id="firstname"
value="#{personBean.firstname}"
required="true"
label="Firstname">
<f:validateLength minimum="2" />
</p:inputText>
Output:
the display element name become Firstname from form:firstname
that's mean the client id overwrited by the value in label attribute.
Done!!
No comments:
Post a Comment