Forums de discussion

Duplicate validation messages in JSF portlet

thumbnail
Juan José Fuentes, modifié il y a 13 années.

Duplicate validation messages in JSF portlet

Junior Member Publications: 48 Date d'inscription: 16/07/10 Publications récentes
Good morning,

We are trying to develop a JSF portlet in Liferay 6.1. We've downloaded and configured the Liferay plugins SDK 6.1 from the nightly build as recommended in a blog here in Liferay.com. We're using Mojarra faces implementation, and the bridge PortletFaces, which is the default for a JSF portlet using the Liferay IDE.

We've managed to reach some port, but we've got problems with the validation messages. For some reason they get duplicated, triplicated... and so on each time we try to validate the form.

This is a sample form that has the error:


<!--?xml version="1.0"?-->
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
      <h:body id="body">
            <h:form id="form2">
                  <h:inputtext id="identificador" required="true"></h:inputtext>
                  <h:commandbutton id="submitform2" value="submit" />
            </h:form>
            <h:messages id="validador"></h:messages>
      </h:body>
</f:view>


Each time we click the submit button a message is ADDED to the message list at the bottom of the form.

We've been debugging a little and the messages seem to be added only once to the FacesContext, so it seems to be a rendering problem in the portlet. Maybe a JSF or bridge configuration issue?

Of course if we try this form in a common web app the messages are rendered only once.

Could someone that has developed a JSF portlet could share a simple validation form with us? We'd be very grateful.

Thank you very much.