You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Cosmin Bucur <co...@gmail.com> on 2005/12/01 03:24:06 UTC

For loop not seeing collection value

Ok , so i'm trying the for loop but ran into another problem .

the forloop has source="ognl:elementCollection" however the
elementCollection is not an abstract set of accessors , but methods
with sligtly more logic in them :

Collection elementCollection;
public Collection getElementCollection() {
 if ( elementCollection == null )
setElementCollection(getManagerBean().findByWhateverCriteriaTheUsrSet(Criteria
c));

return elementCollection;
}
...

What happends is . ForEach gets the collection . For doesn't with :

<div jwcid="@For" source="ognl:elements" value="ognl:element" >

. It throws an exception in tapestry saying that it can't read the
ognl expression : elements .

I figured I maybe do need to dedclare it in the .jwc so I added :
<property name="elements" />

That fixed the tapestry exception , however the For does not gets
rendered which leads me to belive that it's initialised as a null
value .

The Page.java class is abstract , having other normal abstract accessors

Any ideeas ?

Thanks ,
Cosmin

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


Re: For loop not seeing collection value

Posted by Cosmin Bucur <co...@gmail.com>.
I have no explanation for this , I had a System.out.println call in
the getter , and For would not see it .

I just commented that out and it works ...

On 11/30/05, Cosmin Bucur <co...@gmail.com> wrote:
> Ok , so i'm trying the for loop but ran into another problem .
>
> the forloop has source="ognl:elementCollection" however the
> elementCollection is not an abstract set of accessors , but methods
> with sligtly more logic in them :
>
> Collection elementCollection;
> public Collection getElementCollection() {
>  if ( elementCollection == null )
> setElementCollection(getManagerBean().findByWhateverCriteriaTheUsrSet(Criteria
> c));
>
> return elementCollection;
> }
> ...
>
> What happends is . ForEach gets the collection . For doesn't with :
>
> <div jwcid="@For" source="ognl:elements" value="ognl:element" >
>
> . It throws an exception in tapestry saying that it can't read the
> ognl expression : elements .
>
> I figured I maybe do need to dedclare it in the .jwc so I added :
> <property name="elements" />
>
> That fixed the tapestry exception , however the For does not gets
> rendered which leads me to belive that it's initialised as a null
> value .
>
> The Page.java class is abstract , having other normal abstract accessors
>
> Any ideeas ?
>
> Thanks ,
> Cosmin
>

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