Details

      Description

      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:

      <update id="javax.faces.ViewState">
      <![CDATA[...]]>
      </update>

      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

        Activity

        Hide
        frederickkaempfer added a comment -

        "Judging from the JSDoc the request method's execute parameter "

        This was meant to be the render parameter.

        Show
        frederickkaempfer added a comment - "Judging from the JSDoc the request method's execute parameter " This was meant to be the render parameter.
        Hide
        frederickkaempfer added a comment -

        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.

        Show
        frederickkaempfer added a comment - 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.
        Hide
        arjan tijms added a comment -

        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>
        
        1. Press Link A - view state is submitted
        2. Press Link B, then Link A - view state is not submitted anymore
        Show
        arjan tijms added a comment - 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
        Hide
        swathireddy12 added a comment -

        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
        <input type="hidden" name="javax.faces.ViewState" value="!-14uywjgjai">

        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.

        Show
        swathireddy12 added a comment - 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 <input type="hidden" name="javax.faces.ViewState" value="!-14uywjgjai"> 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.
        Hide
        Ed Burns added a comment -

        Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

        Show
        Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

          People

          • Assignee:
            Unassigned
            Reporter:
            frederickkaempfer
          • Votes:
            10 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 5 hours
              5h
              Remaining:
              Remaining Estimate - 5 hours
              5h
              Logged:
              Time Spent - Not Specified
              Not Specified