Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-377

aliasBean saves its children when parent has rendered="false"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0.9m9
    • None
    • Alias Bean
    • None

    Description

      Hello

      <h:panelGroup rendered="#

      {tableColumnForm.inputTypeName == 'label'}">
      <x:aliasBean alias="#{holder}" value="#{tableColumnForm.inputType.visualDefinition}">
      <f:subview id="inputTypeLabelVisualDefinition">
      <jsp:include page="/inc/fontPicker.jsp" />
      </f:subview>
      </x:aliasBean>
      </h:panelGroup>

      This JSF code causes exception although #{tableColumnForm.inputTypeName == 'label'}

      (rendered) is false:

      javax.faces.el.PropertyNotFoundException: Bean: com.kovine.kfe.dao.InputTypeCheckbox, property: visualDefinition
      at org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:464)
      at org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:435)
      at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:398)
      at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:104)
      at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:555)
      at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
      at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:441)
      at org.apache.myfaces.custom.aliasbean.AliasBean.makeAlias(AliasBean.java:270)
      at org.apache.myfaces.custom.aliasbean.AliasBean.makeAlias(AliasBean.java:249)
      at org.apache.myfaces.custom.aliasbean.AliasBean.processSaveState(AliasBean.java:145)
      at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:466)
      at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:466)
      at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:466)
      at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:466)
      at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:454)
      at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:466)
      at org.apache.myfaces.application.jsp.JspStateManagerImpl.getComponentStateToSave(JspStateManagerImpl.java:106)
      at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:249)
      at org.apache.myfaces.taglib.core.ViewTag.doEndTag(ViewTag.java:141)
      at org.apache.jsp.pages.tableColumnForm_jsp._jspx_meth_f_view_0(tableColumnForm_jsp.java:341)
      nForm_jsp.java:341)

      The expression #

      {tableColumnForm.inputType.visualDefinition}

      should be evaluated only if inputType is of type "label" (then #

      {tableColumnForm.inputTypeName == 'label'}). AliasBean tries to save state of all its children without regard if they are (was) rendered or not. In my case, if #{tableColumnForm.inputTypeName == 'label'}

      is false, then #

      {tableColumnForm.inputType} doesn't contain "visualDefinition" property (because it contains reference to another object in that moment) and that causes an exception. If I replace x:aliasBean tag to eg. <h:outputText value="#{tableColumnForm.inputType.visualDefinition.fontFace}" /> then it doesn't throw the exception although #{tableColumnForm.inputType}

      doesn't contain "visualDefinition" property.

      So, in short: aliasBean should not save state of its children when its parent is not rednered (because its children could contain references to for example not existing properties).

      I hope my explanation is enough clear. If not, please notify me (in the comment).

      Thanks in advance for your effort
      Martin

      Attachments

        Activity

          People

            Unassigned Unassigned
            zdila Martin Zdila
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: