PrettyFaces 和 JSF ui:include 导致操作方法被调用两次
我有一个通过 beautifulfaces 请求呈现的 xhtml 视图。我遇到了一个问题,来自 beautifulfaces 的操作映射被执行两次,但仅当我有 ui:include 标签时。示例漂亮的配置如下:
<url-mapping id="testRedirector">
<pattern value="/project/#{lookupBean.projectId}/#{lookupBean.cardNumber}" />
<view-id value="/lookup.xhtml" />
<action>#{myController.init}</action>
</url-mapping>
.xhtml 如下:
...
<ui:include src="/header.xhtml">
<ui:param name="this_tab_class" value="current"/>
</ui:include>
<h:panelGrid columns="4">
...
根据对 URL 的请求,我看到 myController.init() 上的日志调用被执行了两次。如果我注释掉 ui:include,则 init 只会正确调用一次。我已经在 beautifulfaces url 映射元素上尝试了其他 jsf 阶段侦听器,但所有其他枚举类型都会导致 init() 永远不会被调用。
我的问题是,如何实现将预定义的 header.xhtml 或其他预定义组件包含到页面中而不调用 RENDER_REDRAW 阶段两次的相同目标?或者这是一个漂亮面孔特有的问题?
I have an xhtml view being rendered via a prettyfaces request. I am running into a problem where the Action mapping from prettyfaces is being executed twice, but only when I have a ui:include tag. The example pretty config is like this:
<url-mapping id="testRedirector">
<pattern value="/project/#{lookupBean.projectId}/#{lookupBean.cardNumber}" />
<view-id value="/lookup.xhtml" />
<action>#{myController.init}</action>
</url-mapping>
The .xhtml is like this:
...
<ui:include src="/header.xhtml">
<ui:param name="this_tab_class" value="current"/>
</ui:include>
<h:panelGrid columns="4">
...
And upon request to the URL, I see a log call on the myController.init() being executed twice. If I comment out the ui:include, the init is properly only called once. I've experimented wiht the other jsf phase listeners on prettyfaces url-mapping element, but all other enum types result in init() never being called.
My question is, how do I accomplish the same goal of including a predefined header.xhtml, or other predefined component, into a page and not invoke RENDER_REDRAW phase twice? Or is this a pretty-faces specific problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这听起来像是 JSF 错误。当您不包含 PrettyFaces 时会发生这种情况吗?
This sounds like a JSF bug. Does this occur when you do not include PrettyFaces?