MyFaces Core
  1. MyFaces Core
  2. MYFACES-3271

ui:include tag handler evaluates its bindings to soon during JSF lifecycle

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Not A Problem
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: JSR-127
    • Labels:
      None
    • Environment:
      Tomcat 7.x

      Description

      When ui:include uses a bean value binding for its "src" attribute the binding is evaluated during restore view phase. In case binding's value is modified by a postback its value is not reflected when the page is rendered because the binding was already evaluated.

      Original issue: http://jira.icefaces.org/browse/ICE-7017

        Activity

        Mircea Toma created issue -
        Mircea Toma made changes -
        Field Original Value New Value
        Summary ui:include tag handler evaluates its bindings to soon in JSF lifecycle ui:include tag handler evaluates its bindings to soon during JSF lifecycle
        Mircea Toma made changes -
        Description When ui:include uses a bean value binding for its "src" the binding is evaluated during restore view phase. In the case when binding's value is modified by a postback its value is not reflected when the page is rendered because the binding was already evaluated.

        Original issue: http://jira.icefaces.org/browse/ICE-7017
        When ui:include uses a bean value binding for its "src" attribute the binding is evaluated during restore view phase. In case binding's value is modified by a postback its value is not reflected when the page is rendered because the binding was already evaluated.

        Original issue: http://jira.icefaces.org/browse/ICE-7017
        Hide
        Leonardo Uribe added a comment -

        This is expected. The reason why this happens is because MyFaces has an special improvement in this part.

        In facelets 1.1.x, the view is refreshed before render, so as soon as a change is done on invoke application phase, since the view is "refreshed" the hack with <ui:include src="#

        {...}"/> reflects the change.

        In JSF 2.0, with PSS, the view is build on restore view time. But a condition to make it work is the same view should be obtained when PSS algorithm is executed to build a new view. The hack with ui:include just breaks this concept. Everything inside that tag will not be restored correctly because the algorithm can't "calculate" the "initial state".

        But in practice there is a solution on MyFaces Core to deal with this compatibility problem. Just set this web config params:

        <context-param>
        <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name>
        <param-value>true</param-value>
        </context-param>

        and optionally this one too.

        <context-param>
        <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name>
        <param-value>true</param-value>
        </context-param>

        org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS indicate that the view should be always refreshed on a postback.

        org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE activates a special mode in PSS algorithm, so all state inside ui:include src="#{...}

        " will be saved and restored fully (no delta), so the changes on the state will be reflected like in facelets 1.1.x.

        Try only the first or both params to see which case applies.

        I'll close this issue as not a problem.

        Show
        Leonardo Uribe added a comment - This is expected. The reason why this happens is because MyFaces has an special improvement in this part. In facelets 1.1.x, the view is refreshed before render, so as soon as a change is done on invoke application phase, since the view is "refreshed" the hack with <ui:include src="# {...}"/> reflects the change. In JSF 2.0, with PSS, the view is build on restore view time. But a condition to make it work is the same view should be obtained when PSS algorithm is executed to build a new view. The hack with ui:include just breaks this concept. Everything inside that tag will not be restored correctly because the algorithm can't "calculate" the "initial state". But in practice there is a solution on MyFaces Core to deal with this compatibility problem. Just set this web config params: <context-param> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name> <param-value>true</param-value> </context-param> and optionally this one too. <context-param> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name> <param-value>true</param-value> </context-param> org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS indicate that the view should be always refreshed on a postback. org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE activates a special mode in PSS algorithm, so all state inside ui:include src="#{...} " will be saved and restored fully (no delta), so the changes on the state will be reflected like in facelets 1.1.x. Try only the first or both params to see which case applies. I'll close this issue as not a problem.
        Leonardo Uribe made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Leonardo Uribe [ lu4242 ]
        Resolution Not A Problem [ 8 ]
        Hide
        Mircea Toma added a comment -

        Thanks for the quick reply. Adding just org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS context parameter did the trick.

        Show
        Mircea Toma added a comment - Thanks for the quick reply. Adding just org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS context parameter did the trick.
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        37m 2s 1 Leonardo Uribe 08/Aug/11 23:04

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Mircea Toma
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development