javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-1273

Clarify what happens to the current FacesContext during the execution of ViewMetadata.createMetadataView()

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.0, 2.1, 2.2
    • Fix Version/s: None
    • Component/s: Facelets/VDL
    • Labels:
      None

      Description

      See JAVASERVERFACES-3205.

      first.xhtml
      <f:view>
        <f:metadata>
          <f:viewParam name="id" value="#{outcomeTestFirstBean.firstId}"></f:viewParam>
        </f:metadata>
      
      	<h:head>
      	</h:head>
      	<h:form>
      		
      		<h2>Problem description:</h2>
      		When visiting this page using the following link: <a href="?id=11111">/first.jsf?id=11111</a> we can show that include-view-params causes a problem.<br/>
      		Clicking the TestOutcomeLink poses no problem and will load the second page normally.<br/>
      		Any postback will however try to execute the preRenderView event of the OutcomeTestSecondBean (because the metaData is parsed at ViewMetadataImpl.createMetadataView(FacesContext) line: 115)
      		<br/><br/><br/>
      		<h:link outcome="second" value="TestOutcomeLink" includeViewParams="true">
      			<f:param name="extraParam" value="99999" />
      		</h:link>
      		<br/><br/><br/>
      		<h:commandLink value="Postback goes BOOM" action="#{outcomeTestFirstBean.justAnAction}" />&nbsp;
      		<h:commandButton value="Postback goes BOOM" action="#{outcomeTestFirstBean.justAnAction}" />
      	</h:form>
      </f:view>
      

      and

      second.xhtml
      <f:view>
        <f:metadata>
          <f:viewParam name="id" value="#{outcomeTestSecondBean.secondId}"></f:viewParam>
          <f:event listener="#{outcomeTestSecondBean.load}" type="preRenderView" />
        </f:metadata>
      	<h:head>
      	</h:head>
      	<h:form>
      		<h:outputLabel value="#{outcomeTestSecondBean.secondId}" />
      	</h:form>
      </f:view>
      

      When first.xhtml renders, the <h:link> will cause the <f:metadata>
      section of second.xhtml to be executed. This will cause a dummy
      UIViewRoot to be created and thrown away, per the spec. Unfortunately,
      the <f:listener> in second.xhtml's <f:metadata> section ends up on
      first.xhtml's UIViewRoot. The spec for
      ViewMetadata.createMetadataView() must require the existing UIViewRoot,
      if any, to be restored before returning from the method.

        Issue Links

          Activity

          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.
          Hide
          Manfred Riem added a comment -

          Setting priority to Critical

          Show
          Manfred Riem added a comment - Setting priority to Critical

            People

            • Assignee:
              Unassigned
              Reporter:
              Ed Burns
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: