I wanna have just one
我想要一个
<p:growl id="messages"/>
So i have created one form for the whole project with thepages elements and so on as forms inside the main one, something like this.
所以我用整个项目为整个项目创建了一个表单,然后在主要表单中创建了一个表单,就像这样。
<h:form id="mainForm">
<p:growl id="messages" showDetail="true" autoUpdate="true" globalOnly="true" for="mainForm"/>
<div id="container">
<div id="banner" >
<a><img src="#{facesContext.externalContext.requestContextPath}/images/logo.png" alt="" border="0" /></a>
<ui:insert name="head">
<ui:include src="/panels/header.xhtml" />
</ui:insert>
</div>
<div id="content">
<ui:insert name="content">
<ui:include src="/panels/main.xhtml" />
</ui:insert>
</div>
<div id="right">
<ui:insert name="right-sidebar">
<ui:include src="/panels/box.xhtml" />
</ui:insert>
</div>
<div id="footer"><h1>Footer</h1></div>
</div>
</h:form>
The problem comes when one of those panels.. (xhtml) files shows a message it is not shown in the growl of the main page. I have try with for, with global and no luck.
当其中一个面板..(xhtml)文件显示一条消息时,问题就出现了,它没有显示在主页的增长中。我一直在尝试,全球而且没有运气。
In conclusion: how do i create a p:growl once, to handle all of the messages of my site?
总结:我如何创建一个p:growl一次,来处理我网站的所有消息?
Any suggestion
Thnx in advance
Thnx提前
2 个解决方案
#1
0
You should not nest multiple forms (as you sayed you do).
你不应该嵌套多个表格(正如你所说的那样)。
Try to encapsulate the
尝试封装
<p:growl .../>
Tag in one Form before the other includes and just leave the autoUpdate attribute as true. Remove the globalOnly attribute as this will effect, that only FacesMessages for component id "null" will be displayed:
在另一个包含之前在一个表单中标记,并将autoUpdate属性保留为true。删除globalOnly属性,因为这将影响,只显示组件ID“null”的FacesMessages:
<h:form id="mainForm">
<p:growl id="messages" showDetail="true" autoUpdate="true"/>
</h:form>
<div id="container">
<div id="banner" >
<a><img src="#{facesContext.externalContext.requestContextPath}/images/logo.png" alt="" border="0" /></a>
<ui:insert name="head">
<ui:include src="/panels/header.xhtml" />
</ui:insert>
</div>
<div id="content">
<ui:insert name="content">
<ui:include src="/panels/main.xhtml" />
</ui:insert>
</div>
<div id="right">
<ui:insert name="right-sidebar">
<ui:include src="/panels/box.xhtml" />
</ui:insert>
</div>
<div id="footer"><h1>Footer</h1></div>
</div>
Hope this helps you!
希望这对你有所帮助!
#2
0
Finally i manage it to make it work, was something simple, as I suspected it, i had to update the growl which handle the messages.
最后我管理它以使其工作,简单的事情,因为我怀疑它,我不得不更新处理消息的咆哮。
<h:form id="mainForm">
<p:growl id="messages" showDetail="true" autoUpdate="true"/>
</h:form>
like, check the update method.
比如,检查更新方法。
<p:commandButton id="logBut" value="Login" actionListener="#{loginBean.loginUser}" update=":mainForm:message" icon="ui-icon-carat-1-e"/>
that it works with or without nested forms.
它可以使用或不使用嵌套表单。
#1
0
You should not nest multiple forms (as you sayed you do).
你不应该嵌套多个表格(正如你所说的那样)。
Try to encapsulate the
尝试封装
<p:growl .../>
Tag in one Form before the other includes and just leave the autoUpdate attribute as true. Remove the globalOnly attribute as this will effect, that only FacesMessages for component id "null" will be displayed:
在另一个包含之前在一个表单中标记,并将autoUpdate属性保留为true。删除globalOnly属性,因为这将影响,只显示组件ID“null”的FacesMessages:
<h:form id="mainForm">
<p:growl id="messages" showDetail="true" autoUpdate="true"/>
</h:form>
<div id="container">
<div id="banner" >
<a><img src="#{facesContext.externalContext.requestContextPath}/images/logo.png" alt="" border="0" /></a>
<ui:insert name="head">
<ui:include src="/panels/header.xhtml" />
</ui:insert>
</div>
<div id="content">
<ui:insert name="content">
<ui:include src="/panels/main.xhtml" />
</ui:insert>
</div>
<div id="right">
<ui:insert name="right-sidebar">
<ui:include src="/panels/box.xhtml" />
</ui:insert>
</div>
<div id="footer"><h1>Footer</h1></div>
</div>
Hope this helps you!
希望这对你有所帮助!
#2
0
Finally i manage it to make it work, was something simple, as I suspected it, i had to update the growl which handle the messages.
最后我管理它以使其工作,简单的事情,因为我怀疑它,我不得不更新处理消息的咆哮。
<h:form id="mainForm">
<p:growl id="messages" showDetail="true" autoUpdate="true"/>
</h:form>
like, check the update method.
比如,检查更新方法。
<p:commandButton id="logBut" value="Login" actionListener="#{loginBean.loginUser}" update=":mainForm:message" icon="ui-icon-carat-1-e"/>
that it works with or without nested forms.
它可以使用或不使用嵌套表单。