2013-06-03 3 views
0

그룹 생성을 확인하는 메시지를 표시하려고하지만 표시 할 수 없습니다.확인 메시지 표시

group.xhtml :

<h:form id="grp"> 
      <h:panelGrid columns="2"> 

      <h:outputText value="Titre:"></h:outputText> 
      <p:inputText value="#{gpeBean.titre}"></p:inputText> 

     <p:commandButton id="btn_save" 
        value="Créer"        
        actionListener="#{gpeBean.test}"> 
         </p:commandButton> 

        </h:panelGrid> 
    </h:form> 

     </center> 
    </h:panelGrid> 
     <h:form id="cr" rendered = "#{gpeBean.created}"> 
     <h:outputText value="#{gpeBean.message}"/> 
    </h:form> 

내 콩 :

@ManagedBean(name = "gpeBean") 
@RequestScoped 
public class GroupeBean implements Serializable{ 
GroupDAO daoGrp = new GroupDaoImpl(); 
UserDAO dao = new UserDaoImpl(); 
private String titre; 
public String message = ""; 
private boolean created = false; 

    public String test(ActionEvent event){ 
    Groupe p = new Groupe(); 
    p.setTitre(this.titre); 
    daoGrp.Nouveau_groupe(p); 
    created = true; 
    this.setMessage("Groupe crée!"); 
    return "p1"; 
    }} 

나는 방법 테스트를 실행 버튼을 클릭

는 메시지가 표시되지 않습니다.

+0

당신은 @Viewscoped을 시도 했습니까? –

+0

아니요. update = "@ all"의 의미는 무엇입니까? – joice

+0

'return "p1";'과'@ RequestScoped'를 사용하고 있습니다. @Viewscoped를 시도해보십시오. –

답변

0

빈에서 @ViewScoped를 사용합니다.

XHTML은 :

<h:form id="grp"> 
     <h:panelGrid columns="2"> 
      <h:outputText value="Titre:"></h:outputText> 
      <p:inputText value="#{gpeBean.titre}"></p:inputText> 
      <p:commandButton update=":grp:cr" id="btn_save" 
        value="Créer"        
        actionListener="#{gpeBean.test}"> 
         </p:commandButton> 
     </h:panelGrid> 
     <p:outputPanel id="cr"> 
      <h:outputText rendered="#{gpeBean.created}" value="#{gpeBean.message}"/> 
     </p:outputPanel > 
</h:form> 
+0

감사합니다. @RongNK 작동했습니다. – joice

+0

@joice 환영합니다! –