Multiple validation messages don't display in a JSF 2.0 portlet on WebSphere Portal v8.0 and later.

Technote (troubleshooting)


Problem(Abstract)

Multiple validation messages don't display with <h:message> tag in the portlet facelet of a JSF 2.0 portlet on WebSphere Portal v8.0 and later.

Symptom

In the portlet facelet of a JSF 2.0 portlet published on WebSphere Portal v8.0 and later when multiple validation messages are added on one component with <h:message> tag, For example:

<h:form id="form1" styleClass="form">
<h:inputText id="text1" styleClass="inputText">
<f:validateRequired></f:validateRequired>
<f:validateLength minimum="5" maximum="10"></f:validateLength>
</h:inputText>
<h:message for="text1"></h:message>

<h:commandButton type="submit" value="Submit" id="button1"
styleClass="commandButton" action="/<portletname>View.xhtml"></h:commandButton>
</h:form>

For validateRequired, following message will display in UI:

viewns_Z7_1AE81A41JOMKC0AGQ8DP931083_:form1:text1: Validation Error: Value is required.

For validateLength, following message display in console:

0000006c RenderRespons W There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered.
These unhandled FacesMessages are:
- viewns_Z7_1AE81A41JOMKC0AGQ8DP931083_:form1:text1: Validation Error: Value is less than allowable minimum of '5'



Diagnosing the problem

Multiple validation messages don't display with <h:message> tag in the portlet facelet of a JSF 2.0 portlet on WebSphere Portal v8.0 and later.

Resolving the problem

To display multiple validation messages in a JSF 2.0 portlet on WebSphere Portal v8.0 and later:


1. Make sure <h:message> tag is not present.
2. Add <h:messages> tag inside <h:form> tag in the portlet facelet. For example:

<h:form id="form1" styleClass="form">
<h:inputText id="text1" styleClass="inputText">
<f:validateRequired></f:validateRequired>
<f:validateLength minimum="5" maximum="10"></f:validateLength>
</h:inputText>
<h:commandButton type="submit" value="Submit" id="button1"
styleClass="commandButton" action="/<portletname>View.xhtml"></h:commandButton>
<h:messages id="messages1" styleClass="messages"></h:messages>
</h:form>


Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational Application Developer for WebSphere Software
Portal / Portlet Development

Software version:

9.0

Operating system(s):

Windows

Reference #:

1649550

Modified date:

2013-10-09

Translate my page

Machine Translation

Content navigation