2013-01-18 61 views
0

我在下面發佈了我的代碼。一切正常,而面板的屬性 (id = "idPanemCriticas"closable = "false"如何打開屬性可關閉的面板爲真?

如果我將其更改爲true,那麼它不會顯示更多消息,如果關閉面板,則無法打開更多消息。 我真的需要幫助,謝謝。

<h:head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<title>JSF 2 + PrimeFaces</title> 
</h:head> 
<h:body> 
<h:form> 
<p:panel id="idPanelCad" header="Cadastro de Usuário" style="width: 60%;"> 
<h:panelGrid columns="6"> 
<h:outputText value="Nome:" /> 
<p:inputText id="nome" value="#{loginMb.usuario.nome}" required="true" size="20" 
requiredMessage="Informação do nome é obrigatório."> 
<h:outputText value="*" /> 
</p:inputText> 

<h:outputText value="Sobrnome:" /> 
<p:inputText id="idSobreNome" value="#{loginMb.usuario.sobreNome}" 
required="true" size="20" requiredMessage="Informação do sobrenome é obrigatório."> 
</p:inputText> 
<h:outputText value="*" /> 
</h:panelGrid> 

<h:panelGrid columns="3"> 
<h:outputText value="Senha:" /> 
<p:password id="idSenha" value="#{loginMb.usuario.senha}" feedback="true" 
required="true" requiredMessage="Informação da senha é obrigatória."> 
</p:password> 
<h:outputText value="*" /> 
</h:panelGrid> 

<h:panelGrid> 
<p:commandButton value="Gravar" action="#{loginMb.gravar}" update="toUpdate "  
onclick="wp.show();" process="toUpdate"/> 
</h:panelGrid> 

<h:panelGrid> 
<h:outputText value="(*) - Campos com informação obrigatórias." /> 
</h:panelGrid> 

<p:separator> </p:separator> 

<p:outputPanel id="toUpdate"> 
<p:panel id="idPanemCriticas" widgetVar="wp" closable="false" header="Críticas" 
rendered="true"> 
<p:messages id="mss" closable="true" /> 
</p:panel> 
</p:outputPanel> 

</p:panel> 
</h:form> 
</h:body> 
</html> 

回答

0

你嘗試使用autoUpdate="true"屬性,在p:outputPanelp:outputPanel的目標是讓你not to include an element in you element tree。在你的情況下,你的嵌入式p:panelp:messages總是會被渲染,所以我沒有看到使用p:outputPanel來實現這一點。

相關問題