[stringtemplate-interest] quick question

David Moshal dmoshal at gmail.com
Wed May 10 13:34:23 PDT 2006


Thanks for the responses, I don't think I've presented the problem well
enough.
Let me give you the jsp code, and see how you'd do it in ST:

<% for (int i=0; i< 3: i++) { %>

  <tr> <td> <%=i%> </td></tr>

<% } %>

Thanks again
Dave


On 5/10/06, Terence Parr <parrt at cs.usfca.edu> wrote:
>
> Note that you can parallel iterate:
>
> <names,phones : {n,p | ...}>
>
> :)
>
> naturally names can also be a list of lists etc...
>
> Ter
> On May 10, 2006, at 1:22 PM, Jose San Leandro wrote:
>
> > For the first question if I understood well you should be able to
> > do something
> > like
> >
> > <["tr1", "tr2", "tr3"],["td1-1", "td2-1", "tr3-1"], ["td1-2",
> > "td2-2"],
> > ["td1-3"]:{row, td1, td2, td3|\<tr
> > id="<row>">\<td><td1>\</td>\<td><td2>\</td>\<td><td3>\<td>\<tr>};
> > separator="\n">
> >
> > An array of arrays of strings would be better, but there's no
> > method to
> > retrieve an iterator on each row, so I guess it cannot be used. I
> > mean the
> > best would be to use as input something like
> >
> > <[["td1-1", "td1-2", "td1-3"], ["td2-1", "td2-2"], ["td3-1"]]:
> > {row|... }>
> >
> >
> > On Wednesday 10 May 2006 21:56, David Moshal wrote:
> >> Kay - I'm not sure if I explained the problem - I want to create a
> >> fixed
> >> number of rows, eg 3.
> >> There is no model in this case.
> >>
> >> BTW - thanks for the Ter's i18n article - I'm going to look into the
> >> attribute renderer class, it
> >> clearly is a superior way of solving my prior problem regarding
> >> formatting.
> >> Do you know if
> >> one can set an attribute renderer as a wrapper around a whole
> >> model object?
> >>
> >> Dave
> >>
> >> On 5/10/06, Kay Roepke <kroepke at dolphin-services.de> wrote:
> >>> On 10. May 2006, at 19:55 Uhr, David Moshal wrote:
> >>>> Hi - I apologize in advance if this is a completely obvious
> >>>> question:
> >>>>
> >>>> How does one iterate in ST?
> >>>>
> >>>> ie, If I want to create a table with, say 10 rows, how is this
> >>>> done:
> >>>
> >>> (using the AngleBracketTemplateLexer:)
> >>>
> >>> <rows:{row|\<tr><row.datacells:{data|\<td>data.contents\</td>}>\</
> >>> tr>}; separator="\n">
> >>>
> >>> See: http://www.stringtemplate.org/doc/doc.tml
> >>>
> >>> HTH,
> >>>
> >>> -k
> > _______________________________________________
> > stringtemplate-interest mailing list
> > stringtemplate-interest at antlr.org
> > http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20060510/f5e5fda3/attachment.html


More information about the stringtemplate-interest mailing list