You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "F. Da Costa" <da...@xs4all.nl> on 2004/01/29 22:24:15 UTC

ognl.NoSuchPropertyException whilst method setProperty(Obj x) exists?

Hi,

The following snips of code produce the error at the bottom of the screen.
There is also a .script that basically does the same in the first 
generation of the screen.
On clicking the page is re-rendered using the .html line below (using the 
same getRows() as before).
Whilst debugging the setRow method is never entered either.

I've been looking at this for the best part of the day now and I still 
don't understand the *ognl.NoSuchPropertyException* since both the setRow 
and getRow are there. The @Insert deals with the dataCell and no other use 
is made (at least by myself) of the row other than to read it.

Any suggestions (/ what am i doing wrong and missing here)?
TIA
Fermin DCG


.html
<span jwcid="@Foreach" source="ognl:rows" value="ognl:row">
  <span jwcid="@Foreach" source="ognl:dataCells" value="ognl:dataCell">
   <td style="background:lightblue;">
    <span jwcid="@Insert" value="ognl:dataCell">xyz</span>
   </td>
  </span>
</span>

.java
   class Row { // class within page.java
     private List _cells;

     public Row(List cells) {
       _cells = cells;
     }

     public List getCells() {
       return _cells;
     }
}
//=====================================================================
// methods of page.java (getRows works fine and returns a list of Rows)
   public Row getRow() {
     return _row;
   }


   public void setRow(Object value) {
     _row = (Row) value;
   }

   public List getDataCells() {
     return _row.getCells();
   }

   public String getDataCell() {
     return _cell;
   }


   public void setDataCell(String value) {
     _cell =  value;
   }
...

org.apache.tapestry.BindingException
Unable to update expression 'row' for 
tests.HomeContent@14b081b[HomeContent2] to tests.HomeContent$Row@ae97c4.
binding: 	ExpressionBinding[HomeContent2 row]
location: 	classpath:/tests/HomeContent2.html, line 36

ognl.NoSuchPropertyException
row
target: 	tests.HomeContent@14b081b[HomeContent2]
Stack Trace:

     * ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:133)
     * ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1459)
     * ognl.ASTProperty.setValueBody(ASTProperty.java:105)
     * ognl.SimpleNode.setValue(SimpleNode.java:239)
     * ognl.Ognl.setValue(Ognl.java:478)
     * 
org.apache.tapestry.binding.ExpressionBinding.setObject(ExpressionBinding.java:561)
     * org.apache.tapestry.components.Foreach.renderComponent(Foreach.java:155)
...


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ognl.NoSuchPropertyException whilst method setProperty(Obj x) exists (solved)

Posted by "F. Da Costa" <da...@xs4all.nl>.
Paul Ferraro wrote:
> I might be wrong, but I think that in order for OGNL to recognize row as 
> a bean property, the accessor and mutator method signatures have to match.
> Try changing setRow(Object) to setRow(Row), or, alternatively, change 
> getRow() to return Object.
> 
Thx Paul, this was indeed the problem.
Of to nap now and continue in the morning ;)

Fermin


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: ognl.NoSuchPropertyException whilst method setProperty(Obj x) exists?

Posted by Paul Ferraro <pm...@columbia.edu>.
I might be wrong, but I think that in order for OGNL to recognize row as 
a bean property, the accessor and mutator method signatures have to match.
Try changing setRow(Object) to setRow(Row), or, alternatively, change 
getRow() to return Object.

Paul Ferraro

F. Da Costa wrote:

> Hi,
>
> The following snips of code produce the error at the bottom of the 
> screen.
> There is also a .script that basically does the same in the first 
> generation of the screen.
> On clicking the page is re-rendered using the .html line below (using 
> the same getRows() as before).
> Whilst debugging the setRow method is never entered either.
>
> I've been looking at this for the best part of the day now and I still 
> don't understand the *ognl.NoSuchPropertyException* since both the 
> setRow and getRow are there. The @Insert deals with the dataCell and 
> no other use is made (at least by myself) of the row other than to 
> read it.
>
> Any suggestions (/ what am i doing wrong and missing here)?
> TIA
> Fermin DCG
>
>
> .html
> <span jwcid="@Foreach" source="ognl:rows" value="ognl:row">
>  <span jwcid="@Foreach" source="ognl:dataCells" value="ognl:dataCell">
>   <td style="background:lightblue;">
>    <span jwcid="@Insert" value="ognl:dataCell">xyz</span>
>   </td>
>  </span>
> </span>
>
> .java
>   class Row { // class within page.java
>     private List _cells;
>
>     public Row(List cells) {
>       _cells = cells;
>     }
>
>     public List getCells() {
>       return _cells;
>     }
> }
> //=====================================================================
> // methods of page.java (getRows works fine and returns a list of Rows)
>   public Row getRow() {
>     return _row;
>   }
>
>
>   public void setRow(Object value) {
>     _row = (Row) value;
>   }
>
>   public List getDataCells() {
>     return _row.getCells();
>   }
>
>   public String getDataCell() {
>     return _cell;
>   }
>
>
>   public void setDataCell(String value) {
>     _cell =  value;
>   }
> ...
>
> org.apache.tapestry.BindingException
> Unable to update expression 'row' for 
> tests.HomeContent@14b081b[HomeContent2] to tests.HomeContent$Row@ae97c4.
> binding:     ExpressionBinding[HomeContent2 row]
> location:     classpath:/tests/HomeContent2.html, line 36
>
> ognl.NoSuchPropertyException
> row
> target:     tests.HomeContent@14b081b[HomeContent2]
> Stack Trace:
>
>     * 
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:133)
>     * ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1459)
>     * ognl.ASTProperty.setValueBody(ASTProperty.java:105)
>     * ognl.SimpleNode.setValue(SimpleNode.java:239)
>     * ognl.Ognl.setValue(Ognl.java:478)
>     * 
> org.apache.tapestry.binding.ExpressionBinding.setObject(ExpressionBinding.java:561) 
>
>     * 
> org.apache.tapestry.components.Foreach.renderComponent(Foreach.java:155)
> ...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org