我有一个片段代码如下
<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 :(得分:2)
将咆哮声放在你自己的形式中,如下所示
<h:form id="login-form">
<p:growl id="noti-growl"/>
</h:form>
或者您应该通过将growl以不同的形式更新为全名:
<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>