Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-alpha
    • Fix Version/s: 2.0.0-beta
    • Component/s: JSR-314
    • Labels:
      None

      Description

      MIchael Kurz tested Mojarra and found out that <f:facet> now can have more than one child. If so, the children will automaticall be put in a UIPanel to serve facet requirements.

      However, this improvement is not mentioned in the spec, filed spec issue: https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=677

      1. myfaces-2435.patch
        15 kB
        Jakob Korherr

        Activity

        Hide
        Jakob Korherr added a comment -

        spec describes this behaviour in section 10.4.1.3 <f:metadata>:

        " [...] The implementation must ensure that the direct child of the facet is a UIPanel, even if there is only one child of the facet. [...]"

        Show
        Jakob Korherr added a comment - spec describes this behaviour in section 10.4.1.3 <f:metadata>: " [...] The implementation must ensure that the direct child of the facet is a UIPanel, even if there is only one child of the facet. [...] "
        Hide
        Jakob Korherr added a comment -

        Here is my patch for this issue.

        The patch allows f:facet to have more than one child on facelets and on jsps. The child(ren) will automatically be put in a UIPanel, which will be marked with "org.apache.myfaces.facet.createdUIPanel" = Boolean.TRUE. However, if the only child of a f:facet tag is an instance of UIPanel, this instance will be used directly.

        Show
        Jakob Korherr added a comment - Here is my patch for this issue. The patch allows f:facet to have more than one child on facelets and on jsps. The child(ren) will automatically be put in a UIPanel, which will be marked with "org.apache.myfaces.facet.createdUIPanel" = Boolean.TRUE. However, if the only child of a f:facet tag is an instance of UIPanel, this instance will be used directly.
        Hide
        Leonardo Uribe added a comment -

        Suppose this case:

        <h:dataTable value="#

        {company.departments}

        " var="dept">
        <h:column>
        <f:facet name="header">
        <h:outputText value="#

        {dept.name}"/>
        </f:facet>
        <h:outputText value="#{dept.name}

        "/>
        </h:column>
        </h:dataTable>

        In theory since there only one child, the facet must not wrap it in UIPanel, because it is not necessary and this is expected from 1.2. This was notice running
        org.apache.myfaces.view.facelets.tag.jsf.html.DataTableTestCase.

        It is optional let this case for jsp, because f:metadata does not exists there.

        Show
        Leonardo Uribe added a comment - Suppose this case: <h:dataTable value="# {company.departments} " var="dept"> <h:column> <f:facet name="header"> <h:outputText value="# {dept.name}"/> </f:facet> <h:outputText value="#{dept.name} "/> </h:column> </h:dataTable> In theory since there only one child, the facet must not wrap it in UIPanel, because it is not necessary and this is expected from 1.2. This was notice running org.apache.myfaces.view.facelets.tag.jsf.html.DataTableTestCase. It is optional let this case for jsp, because f:metadata does not exists there.
        Hide
        Jakob Korherr added a comment -

        I know, but spec says that every child of the facet has to be an UIPanel:

        " [...] The implementation must ensure that the direct child of the facet is a UIPanel, even if there is only one child of the facet. [...]"

        Show
        Jakob Korherr added a comment - I know, but spec says that every child of the facet has to be an UIPanel: " [...] The implementation must ensure that the direct child of the facet is a UIPanel, even if there is only one child of the facet. [...] "
        Hide
        Leonardo Uribe added a comment -

        Thanks to Jakob Korherr for this patch. I commit the facelet part but not the jsp (changes related to UIComponentClassicTagBase) because the part that mention in the spec this behavior is chapter 10 Facelets and f:metadata does not exists on jsp. Note section 9.4.6 related to f:facet is clear that only contains one component, but this chapter is related to JSP integration.

        Show
        Leonardo Uribe added a comment - Thanks to Jakob Korherr for this patch. I commit the facelet part but not the jsp (changes related to UIComponentClassicTagBase) because the part that mention in the spec this behavior is chapter 10 Facelets and f:metadata does not exists on jsp. Note section 9.4.6 related to f:facet is clear that only contains one component, but this chapter is related to JSP integration.
        Hide
        Jakob Korherr added a comment -

        OK. good solution.

        Show
        Jakob Korherr added a comment - OK. good solution.
        Hide
        Leonardo Uribe added a comment -

        The patch committed does not handle the case an instance of UIInstruction (text) is added. So, when a facet is created like this:

        <f:facet>
        some text
        <x:component .../>
        some more text
        <y:component .../>
        </f:facet>

        It fails to add properly. The solution is fix AbstractUIHandler.addComponent, but it seems better to relocate the code from ComponentTagHandlerDelegate to ComponentSupport because this code will be called later from InsertFacetHandler to solve MYFACES-2483.

        Show
        Leonardo Uribe added a comment - The patch committed does not handle the case an instance of UIInstruction (text) is added. So, when a facet is created like this: <f:facet> some text <x:component .../> some more text <y:component .../> </f:facet> It fails to add properly. The solution is fix AbstractUIHandler.addComponent, but it seems better to relocate the code from ComponentTagHandlerDelegate to ComponentSupport because this code will be called later from InsertFacetHandler to solve MYFACES-2483 .

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Jakob Korherr
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development