Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3462

REGRESSION - Detect when to wpdate head or body target when content has been updated dynamically

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.12, 2.1.6
    • 2.0.13, 2.1.7
    • JSR-314
    • None

    Description

      Related to topic sent on jsr344-experts list:

      [jsr344-experts] Facelet page with dynamic content and update ajax content does not work as user expects

      Now take a look at this example:

      include.xhtml

      <h:commandLink ...>
      <f:ajax render="content"/>
      </h:commandLink>
      ...
      <f:subview id="content">
      <ui:include src="#

      {testManagedBean.page}

      "/>
      </f:subview>

      page1.xhtml

      <ui:composition
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
      <h:outputText id="component1" value="Page 1"/>
      <!-- ... more components ... -->
      </ui:composition>

      page2.xhtml

      <ui:composition
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
      <h:outputStylesheet ... />
      <h:outputText id="component2" value="Page 2"/>
      <!-- ... more components ... -->
      </ui:composition>

      Here the problem is if the dynamic content changes and add a resource under
      "head" target (h:outputStylesheet does that), shouldn't be added a section
      on the ajax payload to update the <head> section? In theory yes, because
      this breaks encapsulation principle. If the user says render all inside
      content if the <head> section changes it is responsability of the framework
      (in this case PartialViewContext) to detect that an send the correct
      payload, right?. Here we have two options:

      a. Keep track of the resources rendered and save that on the state, then use
      that information to check if the head should be rendered.
      b. Use PostAddToViewEvent to check when a change on the component tree has
      triggered a change on the head.

      Option b. save some bytes on the state but it could cause render <head>
      section more than necessary (for example a dynamic change but the head
      has already rendered the resource, so it is not necessary). Option a.
      impose that you need a way to check if the <head> was changed, and
      require changes on the spec.

      I'll solve this problem adding a web config param:

      org.apache.myfaces.STRICT_JSF_2_REFRESH_TARGET_AJAX

      on MyFaces and doing some
      changes on the algorithm, adding a flag to indicate if a view is being built
      by first time.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment