You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Albert Lu <al...@nmdp.org> on 2003/07/17 23:14:40 UTC

Re: #foreach and nulls; bug or feature?. It's a bug to me. recalled!

I want to recall this.

Albert Lu wrote:

> If value at the first index is null, vm does not step inside the loop at all.
> I consider this is a bug.
>
> My bean has a getter
> List[] getErrorsOnPage(){
> }
>
> in the vm template I have:
> #foreach ($errorOnPage in $formBean.errorsOnPage)
>     show me this line
> #end
>
> It did not print out any line at all.
>
> Albert Lu
>
> Eelco Hillenius wrote:
>
> > Hi,
> >
> > When iterating a list that has null values, the last value before the null
> > is kept. E.g:
> >
> > Take list: {"one", "two", null, null, "five").
> > #foreach( $val in $list)
> >     <tr><td>$!{val}</td></tr>
> > #end
> > will show:
> >
> > one
> > two
> > two
> > two
> > five
> >
> > where I expected either
> >
> > one
> > two
> >
> > five
> >
> > or
> >
> > one
> > two
> > five
> >
> > Is this a bug or a feature?
> >
> > Eelco Hillenius
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org

--
Albert Lu
National Marrow Donor Program
3433 Broadway Street NE, Suite 500
Minneapolis, MN 55413
http://www.marrow.org/
Phone: 612-627-8162
Email: alu@nmdp.org



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