I have updated to Primefaces 3 RC1, then my p:wizard started to work strange...
Its cleaning the selection of my f:selectItems, so JSF validation says that nothing has been selected and don't execute the action in p:commandButton. The code below shows the problem:
view.xhtml
Code: Select all
<h:form id="form" prependId="false">
<p:wizard id="wizard"
widgetVar="wiz"
flowListener="#{chamado.eventoProsseguir}"
nextLabel="Proximo" backLabel="Anterior">
<p:tab id="tabSolicitante" title="Solicitante">
<p:panel header="Dados do Solicitante">
<p:messages/>
<h:panelGrid columns="2">
<h:outputText value="Solicitante: " />
<p:selectOneMenu id="solicitante"
value="#{chamado.solicitante.nome}"
required="true"
requiredMessage="Selecione o solicitante antes de prosseguir!">
<f:selectItems var="item" value="#{chamado.listaSolicitantes}" itemValue="#{item.nome}" itemLabel="#{item.nome}"/>
</p:selectOneMenu>
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab id="tabServico" title="Serviço">
<p:panel header="Dados do Serviço">
<p:messages/>
<h:panelGrid columns="2" >
<h:outputText value="Serviço: " />
<p:selectOneMenu id="servico"
value="#{chamado.servico.nome}"
required="true"
requiredMessage="Selecione o serviço antes de prosseguir!">
<f:selectItems var="item" value="#{chamado.listaServicos}" itemValue="#{item.nome}" itemLabel="#{item.nome}"/>
</p:selectOneMenu>
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab id="tabConfirmacao" title="Confirmação">
<p:panel header="Confirmação">
<p:messages/>
<h:panelGrid columns="2" cellspacing="20px" width="100%">
<h:outputText value="Solicitante:" />
<h:outputText value="#{chamado.solicitante.nome}" />
<h:outputText value="Serviço: " />
<h:outputText value="#{chamado.servico.nome}"/>
<h:outputText value="Descrição: " />
<p:inputTextarea value="#{chamado.descricao}"
style="width: 350px"
required="true"
requiredMessage="Preencha a descrição antes de abrir o chamado!"/>
</h:panelGrid>
<p:commandButton value="Abrir Chamado" action="#{chamado.abrirChamado()}" ajax="false" />
</p:panel>
</p:tab>
</p:wizard>
</h:form>
Code: Select all
@ManagedBean(name = "chamado")
@ViewScoped
public class ChamadoBean implements Serializable
{
private Solicitante solicitante;
private Servico servico;
private String descricao;
public String eventoProsseguir(FlowEvent event)
{
if (event.getNewStep().equals("tabServico") && getSolicitante().getNome() == null)
{
FacesContext.getCurrentInstance().addMessage("Mensagem", new FacesMessage(FacesMessage.SEVERITY_WARN,
"Cadastre algum solicitante antes de prosseguir!",""));
return event.getOldStep();
}
else if (event.getNewStep().equals("tabConfirmacao") && getServico().getNome() == null)
{
FacesContext.getCurrentInstance().addMessage("Mensagem", new FacesMessage(FacesMessage.SEVERITY_WARN,
"Cadastre algum serviço antes de prosseguir!",""));
return event.getOldStep();
}
return event.getNewStep();
}
public String abrirChamado()
{
//persist the bean...
}
public Collection getListaSolicitantes()
{
//returns a collection from model...
}
public Collection getListaServicos()
{
//returns a collection from model...
}
//Getters and Setters
}
When I go back to Prime 3.0.0M4 it works fine...
Any ideas?
Thanks!