faces
faces copied to clipboard
Allow parents of forms as render targets of ajax requests
Currently it is not possible to use parents of forms as render targets in <f:ajax/> or jsf.ajax.request. If an element containing one or more forms is specified in the render attribute, these forms' ViewState is not updated during the Ajax request. In my opinion it is not clear from the JSDocs, if parents of forms are allowed as render targets or not. Mojarra currently does not create an error in that case, however the jsf.ajax.request method does not create a ViewState field for descendant forms either.
Judging from the JSDoc the request method's execute parameter is not limited to forms and children of forms, it just takes a list of arbitrary client ids. It's also possible to specify '@all' for the whole view thus most likely a parent of multiple forms, which works as expected.
However the JSDoc for jsf.ajax.response states the following for ViewState updates:
If an update element is found in the response with the identifier javax.faces.ViewState:
locate and update the submitting form's javax.faces.ViewState value with the CDATA contents from the response. Locate and update the javax.faces.ViewState value for all forms specified in the render target list.
This will clearly not work if only forms that are contained in the render target list directly are considered, because the list could also contain parents of forms.
For more information see the corresponding Mojarra bug report:
http://java.net/jira/browse/JAVASERVERFACES-1718
Affected Versions
[2.1]
- Issue Imported From: https://github.com/javaee/javaserverfaces-spec/issues/1024
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: Unassigned
@glassfishrobot Commented Reported by frederickkaempfer
@glassfishrobot Commented frederickkaempfer said: "Judging from the JSDoc the request method's execute parameter "
This was meant to be the render parameter.
@glassfishrobot Commented frederickkaempfer said: This issue is related to (or even included in) http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-790. Since this is obviously a spec bug and a fix is quite simple (updating all forms instead of only a subset defined by the render attribute on an ajax request, see Ed Burns' comment on 790) it would definitely be worth considering for 2.2.
@glassfishrobot Commented @arjantijms said: Simple test case from duplicate issue JAVASERVERFACES-1788:
<h:panelGroup layout="block" id="group">
<h:form>
<h:commandLink value="Link A">
<f:ajax />
</h:commandLink>
</h:form>
</h:panelGroup>
<h:form>
<h:commandLink value="Link B">
<f:ajax render=":group" />
</h:commandLink>
</h:form>
- Press Link A - view state is submitted
- Press Link B, then Link A - view state is not submitted anymore
@glassfishrobot Commented swathireddy12 said: I am making use of JSF 1.2 version of jars (myfaces-api-1.2.9.jar ,myfaces-impl-1.2.9.jar,trinidad-api-1.2.13.jar,trinidad-impl-1.2.13.jar). I am trying to retrieve the javax.faces.ViewState using the id attribute in a Javascript which works.
But i still don't see the id attribute in the loaded page
Could you please tell me if this is an issue with JSF 1.2 version as well? Or once the page is rendered the id attribute associated with "javax.faces.ViewState" is not seen anymore.
@glassfishrobot Commented @edburns said: Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.
@glassfishrobot Commented This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-1024