Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Components/Renderers
    • Labels:
      None

      Description

      In JSF a component can put a variable into a scope to make it usable for its child components, or possibly other components on the page.

      E.g.

      <ui:repeat value="#{someBean.items}" var="item">
          <h:outputText value="#{item.name}" />
      </ui:repeat>
      

      In this example the ui:repeat component selects a value from someBean.items and makes that available under the name item.

      In order for tools to validate the correctness of the item.name expression, they currently make use of hardcoded knowledge of what well known components do. This means that components from libraries that are not explicitly supported by such tools can't be validated. Custom components made by users are thus never validated.

      I would like to propose adding a mechanism to JSF for components to declare they make (scoped) variables available.

      E.g.

      @FacesComponent("components.CustomComponent")
      public class CustomComponent extends UIComponentBase {
      
          @Attribute
          @VariableName(type="#{attributes.value[0]}" scope="component")
          private String var;
      
          @Attribute
          @VariableSource
          private List<Item> value;
      

      In this example, the component declares that the var attribute is the name for data that is made available during the 'scope of the component' and that the type of this data is an element from the value attribute.

      Additionally, it should also be possible that a fixed type is specified, e.g:

      @FacesComponent("components.CustomComponent")
      public class CustomComponent extends UIComponentBase {
      
          @Attribute
          @VariableName(type="com.example.SomeType" scope="component")
          private String var;
      

      Of course the given syntax is just a quick sketch of the idea. Maybe @VariableExportName is a better name, @VariableSource might not be needed, etc.

      This issue is somewhat related to JAVASERVERFACES_SPEC_PUBLIC-594

        Activity

        Hide
        arjan tijms added a comment -

        Issue JAVASERVERFACES_SPEC_PUBLIC-984 might also be somewhat related to this.

        Show
        arjan tijms added a comment - Issue JAVASERVERFACES_SPEC_PUBLIC-984 might also be somewhat related to this.
        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:
            arjan tijms
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: