2013-08-01 103 views
0

我有一段代碼如下錯誤與咆哮

<p:growl id="noti-growl"/> 
     <h:form id="login-form"> 
      <p:panel> 
       <h:commandButton value="Đăng nhập" class="button-login" action="index"> 
        <f:ajax execute="@form" render="noti-growl"/> 
       </h:commandButton> 
      </p:panel> 
     </h:form> 

而且我收到了一條錯誤如下

<f:ajax> contains an unknown id 'noti-growl' - cannot locate it in the context of the component j_idt9 

請爲我解釋一下嗎?感謝您的幫助

+0

可能重複[如何引用JSF ajax中的組件?無法在視圖中查找標識符爲「foo」的組件)(http://stackoverflow.com/questions/8634156/how-to-reference-components-in-jsf-ajax-cannot-find-component-with-identifier) – Andy

回答

2

要麼把咆哮在自己的形式如下

<h:form id="login-form"> 
    <p:growl id="noti-growl"/> 
</h:form> 

或者你應該把咆哮不同形式的全名更新:的

<h:form id = "growlForm">  
    <p:growl id="noti-growl"/> 
</form> 

<h:form id="login-form"> 
     <p:panel> 
      <h:commandButton value="Đăng nhập" class="button-login" action="index" update = ":growlForm:noti_growl"> 

     </p:panel> 
    </h:form> 
+0

感謝你這麼多 – ThiepLV

+0

不客氣:) –