You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark <ma...@xeric.net> on 2011/07/09 01:04:56 UTC

Loop Behaviour on Null or Empty List

<li type="loop" source="department.people" value="person">
	${person.name}
</li>


If department.people is null or contains a collection with zero items,
I would expect ${person.name} to never be evaluated.  However, I'm
getting an error saying that person is null within the express
person.name.

Are there any conditions that will cause the interior of the loop to
be evaluated even if there are no items in the collection?

Mark

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


Re: Loop Behaviour on Null or Empty List

Posted by Mark <ma...@xeric.net>.
Argh.... I can't believe I did that.  Thank you! :)

On Fri, Jul 8, 2011 at 6:17 PM, Josh Canfield <jo...@gmail.com> wrote:
> Looks like a typo.
>
>> <li type="loop" source="department.people" value="person">
> This should be
> <li t:type="loop"...
> ----^^
>
> You need the namespace to tell tapestry you want it to be a component.
>
> Josh
>
> On Fri, Jul 8, 2011 at 4:04 PM, Mark <ma...@xeric.net> wrote:
>> <li type="loop" source="department.people" value="person">
>>        ${person.name}
>> </li>
>>
>>
>> If department.people is null or contains a collection with zero items,
>> I would expect ${person.name} to never be evaluated.  However, I'm
>> getting an error saying that person is null within the express
>> person.name.
>>
>> Are there any conditions that will cause the interior of the loop to
>> be evaluated even if there are no items in the collection?
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: Loop Behaviour on Null or Empty List

Posted by Josh Canfield <jo...@gmail.com>.
Looks like a typo.

> <li type="loop" source="department.people" value="person">
This should be
<li t:type="loop"...
----^^

You need the namespace to tell tapestry you want it to be a component.

Josh

On Fri, Jul 8, 2011 at 4:04 PM, Mark <ma...@xeric.net> wrote:
> <li type="loop" source="department.people" value="person">
>        ${person.name}
> </li>
>
>
> If department.people is null or contains a collection with zero items,
> I would expect ${person.name} to never be evaluated.  However, I'm
> getting an error saying that person is null within the express
> person.name.
>
> Are there any conditions that will cause the interior of the loop to
> be evaluated even if there are no items in the collection?
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: Loop Behaviour on Null or Empty List

Posted by Mark <ma...@xeric.net>.
Hm.  This seems to fix it:

<t:loop source="department.people" value="person">
	<li>${person.name}</li>
</t:loop>

Is this a bug or should we expect different behavior with:

<li type="loop" source="department.people" value="person">
       ${person.name}
</li>

On Fri, Jul 8, 2011 at 6:04 PM, Mark <ma...@xeric.net> wrote:
> <li type="loop" source="department.people" value="person">
>        ${person.name}
> </li>
>
>
> If department.people is null or contains a collection with zero items,
> I would expect ${person.name} to never be evaluated.  However, I'm
> getting an error saying that person is null within the express
> person.name.
>
> Are there any conditions that will cause the interior of the loop to
> be evaluated even if there are no items in the collection?
>
> Mark
>

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