Uploaded image for project: 'Commons OGNL (Dormant)'
  1. Commons OGNL (Dormant)
  2. OGNL-87

Get an ognl.InappropriateExpressionException when negating a boolean

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.7
    • 2.7
    • ExpressionCompiler
    • None
    • java 1.5.0_07, tomcat 5.5.24, osx 10.4.9

    Description

      I think it's easier to show what works, and then show a simple change which causes the error:

      <form jwcid="showActiveForm" class="showActiveForm">

      <input type="checkbox" jwcid="showInactivePeople"/>Show Inactive People

      </form>

      <component id="showActiveForm" type="Form"/>

      <component id="showInactivePeople" type="Checkbox">

      <binding name="value" value="ognl:useActivePeopleOnly"/>

      </component>

      @InitialValue("ognl: false") @Persist

      public abstract boolean getUseActivePeopleOnly();

      public abstract void setUseActivePeopleOnly(boolean useActivePeopleOnly);

      @EventListener(targets = "showInactivePeople", events = "onclick", async = true, submitForm="showActiveForm", validateForm = false)

      public void showActivePeople(IRequestCycle cycle)

      { cycle.getResponseBuilder().updateComponent("peopleTable"); }

      So this works fine, updating the people table to show or not show the people who are not active. The only problem being, of course, that the checkbox is checked when it should be unchecked and vice-versa.

      Changing the binding to the following however, causes the exception:

      <binding name="value" value="ognl:!useActivePeopleOnly"/>

      And here's the exception:

      Unable to update OGNL expression '<parsed OGNL expression>' of $AdminPeople_139@a1655b81[Admin/adminPeople] to false: Inappropriate OGNL expression: useActivePeopleOnly

      binding: ExpressionBinding[Admin/adminPeople !useActivePeopleOnly]

      location: context:/WEB-INF/admin/AdminPeople.jwc, line 96, column 66

      91

      92 <component id="showActiveForm" type="Form"/>

      93

      94 <component id="showInactivePeople" type="Checkbox">

      95 <!-- TODO this is causing OGNL Exception -->

      96 <binding name="value" value="ognl:!useActivePeopleOnly"/>

      97 </component>

      98

      99

      ognl.InappropriateExpressionException

      Inappropriate OGNL expression: useActivePeopleOnly

      Stack Trace:

      • ognl.SimpleNode.setValueBody(SimpleNode.java:299)
      • ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:208)
      • ognl.SimpleNode.setValue(SimpleNode.java:287)
      • ognl.Ognl.setValue(Ognl.java:618)
      • org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.writeCompiled(ExpressionEvaluatorImpl.java:192)
      • $ExpressionEvaluator_113071fd785.writeCompiled($ExpressionEvaluator_113071fd785.java)
      • org.apache.tapestry.binding.ExpressionBinding.setObject(ExpressionBinding.java:211)
      • $Checkbox_141.setValue($Checkbox_141.java)
      • org.apache.tapestry.form.Checkbox.rewindFormComponent(Checkbox.java:88)
      • org.apache.tapestry.form.AbstractFormComponent.renderComponent(AbstractFormComponent.java:94)
      • org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:723)
      • org.apache.tapestry.services.impl.DojoAjaxResponseBuilder.render(DojoAjaxResponseBuilder.java:595)

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            woodj Julian Wood
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: