[stringtemplate-interest] Fwd: Re: Conditional iterations
Harald Mueller
harald_m_mueller at gmx.de
Sun Oct 24 09:20:28 PDT 2010
-------- Original-Nachricht --------
Datum: Sun, 24 Oct 2010 18:19:21 +0200
Von: "Harald Mueller" <harald_m_mueller at gmx.de>
An: Ivan Gallo <ivgallo at gmail.com>
Betreff: Re: [stringtemplate-interest] Conditional iterations
There are two possibilities:
* Preferably, you have to create a clone of you model which somehow marks the row (so that you have a boolean property you can use in a standard $if$);
OR
* you use a tricky way to implement an equals operator; I showed how to do this in http://www.antlr.org/pipermail/stringtemplate-interest/2010-March/002637.html - the implementation is in C#; however, the same concept works for Java.
The first method sometimes requires a fundamental shift on what a "model" is: Not something stable created once, but a structure that is sometimes cloned multiple (100s) times to mark some special places so Stringtemplate can work using $if$s or $(indirect macros)$.
Hope this short teaser helps you ...
Regards
Harald
-------- Original-Nachricht --------
> Datum: Sun, 24 Oct 2010 11:04:40 -0500
> Von: Ivan Gallo <ivgallo at gmail.com>
> An: stringtemplate-interest at antlr.org
> Betreff: [stringtemplate-interest] Conditional iterations
> how I can do this in stringtemplate, conditional expression only accepts
> boolean values ?
>
> <select id="city" name="city">
> <option value=""></option>
> <c:forEach var ="row" items="${cities}">
> <option value="${row.code}" ${row.code == s.code
> ?'selected':''}>${row.name}</option>
> </c:forEach>
> </select>
>
> s.code is a value of javabeans
>
>
> --
> Ivan Gallo P
> SCJP
> cel 3008165846
--
GMX DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl
--
GRATIS! Movie-FLAT mit über 300 Videos.
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome
More information about the stringtemplate-interest
mailing list