java可以在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已完全失效
# 1 楼答案
我认为第一个命令链接应该在h:表单中
# 2 楼答案
看起来不错。当您在链接或其父节点之一上设置了
rendered
属性,并且bean在请求范围内时,它将失败。如果bean被放在视图范围内,并且您总是从应该返回到同一视图的链接操作返回null
或void
,那么这应该是可行的。这样rendered
属性的条件将被保留。JSF即在表单提交的apply request values(应用请求值)阶段重新检查该条件,作为防止黑客/篡改请求的一部分另请参见: