Can you cascade ajax rendered content in JSF 2.0?
Example:
<h:form>
<h:commandLink action="#{someBean.someAction}">
<f:ajax render="somePanel"/>
</h:commandLink>
<h:panelGroup id="somePanel">
<h:commandLi开发者_StackOverflownk 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.
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 return null
or void
from link actions which should return to the same view. This way the conditions for the rendered
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:
- commandButton/commandLink/ajax action/listener method not invoked or input value not updated (lists all possible causes)
i think first command link should be inside h:form
精彩评论