你能在 JSF 2.0 中级联 ajax 渲染的内容吗?
示例:
<h:form>
<h:commandLink action="#{someBean.someAction}">
<f:ajax render="somePanel"/>
</h:commandLink>
<h:panelGroup id="somePanel">
<h:commandLink action="#{someBean.otherAction}">
<f:ajax render="otherPanel">
</h:commandLink>
<h:panelGroup id="otherPanel">
some content here
</h:panelGroup>
</h:panelGroup>
</h:form>
显然,我问这个问题是因为我无法完成这项工作。嵌套的 commandLink 完全死了。
Example:
<h:form>
<h:commandLink action="#{someBean.someAction}">
<f:ajax render="somePanel"/>
</h:commandLink>
<h:panelGroup id="somePanel">
<h:commandLink action="#{someBean.otherAction}">
<f:ajax render="otherPanel">
</h:commandLink>
<h:panelGroup id="otherPanel">
some content here
</h:panelGroup>
</h:panelGroup>
</h:form>
Obviously, I am asking because I couldn't make this work. The nested commandLink is utterly dead.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来不错。当您实际上在链接或其父级之一上设置了
rendered
属性并且bean位于请求范围内时,它将失败。如果将 bean 放入视图范围中并且您始终从应返回同一视图的链接操作返回 null 或 void ,则此操作应该有效。这样,rendered
属性的条件将被保留。即,JSF 在表单提交的应用请求值阶段重新检查此条件,作为防止黑客攻击/篡改请求的一部分。另请参阅:
It looks fine. It will fail when you've actually a
rendered
attribute set on the link or one of its parents and the bean is in request scope. This should work if the bean is put in the view scope and you always returnnull
orvoid
from link actions which should return to the same view. This way the conditions for therendered
attribute will be preserved. JSF namely rechecks this condition during apply request values phase of the form submit as part of safeguard against hacked/tampered requests.See also:
我认为第一个命令链接应该在 h:form 内
i think first command link should be inside h:form