I have a question about primefaces messages. I have a flow where user can change his password. Before it is saved to database validation takes place. If the validation fails error messages are shown. The problem is that these messages are shown twice in different places: in the <p: messages> block defined in xhtml and in the form's right upper corner.
My version of primefaces is 2.2.1
Here is my flow:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<action-state id="start">
<evaluate expression="userService.getUser(currentUser.name)"
result="flowScope.user"></evaluate>
<transition to="view"></transition>
</action-state>
<view-state id="view" view="profile-view.xhtml">
<transition on="edit" to="edit" />
<transition on="cancel" to="cancel"></transition>
</view-state>
<view-state id="edit" view="profile-edit.xhtml">
<transition on="back" to="start"></transition>
<transition on="cancel" to="cancel"></transition>
<transition on="save" to="actionSave"></transition>
</view-state>
<action-state id="actionSave">
<evaluate expression="userValidator.validate()"></evaluate>
<transition to="edit"></transition>
</action-state>
<end-state id="cancel"></end-state>
</flow>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://primefaces.prime.com.tr/ui"
xsi:schemaLocation="
http://java.sun.com/jsf/facelets facelets-ui-2.0.xsd
http://java.sun.com/jsf/core jsf-core-2.0.xsd
http://java.sun.com/jsf/html html-basic-2.0.xsd"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="content">
<h:form>
<p:fieldset legend="Edit profile">
<p:messages id="userFormMsgs"/>
<div align="center">
<h:panelGrid columns="2">
<h:outputLabel for="user" value="Username " />
<p:inputText id="user" value="#{userValidator.username}" />
<h:outputLabel for="old-pass" value="Old password " />
<p:password id="old-pass" value="#{userValidator.oldPass}"
feedback="false" label="Password" />
<h:outputLabel for="new-pass" value="New password " />
<p:password id="new-pass" value="#{userValidator.newPass}" feedback="false" />
<h:outputLabel for="new-pass-confirm"
value="Confirm new password " />
<p:password id="new-pass-confirm" value="#{userValidator.newPassConfirmed}" feedback="false" />
</h:panelGrid>
<p:commandButton action="save" value="Save"
update="userFormMsgs" />
<p:commandButton action="back" value="Back" />
<p:commandButton action="cancel" value="Cancel" />
</div>
</p:fieldset>
</h:form>
</ui:define>
</ui:composition>
Thank you in advance.