Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| X-Received | by 10.107.47.12 with SMTP id j12mr5413158ioo.26.1444295676598; Thu, 08 Oct 2015 02:14:36 -0700 (PDT) |
|---|---|
| X-Received | by 10.182.116.130 with SMTP id jw2mr39607obb.4.1444295676567; Thu, 08 Oct 2015 02:14:36 -0700 (PDT) |
| Path | csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!kq10no18345831igb.0!news-out.google.com!z4ni14685ign.0!nntp.google.com!kq10no18345824igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | it.comp.java |
| Date | Thu, 8 Oct 2015 02:14:36 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=2.238.130.92; posting-account=4bC-cgoAAACMBchwcpaJi46ElwAEHSHO |
| NNTP-Posting-Host | 2.238.130.92 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <d890ba23-0f5e-494e-933d-13e7791d3084@googlegroups.com> (permalink) |
| Subject | stringtemplate e STGroup |
| From | sessantaquattrobits@gmail.com |
| Injection-Date | Thu, 08 Oct 2015 09:14:36 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com it.comp.java:8593 |
Show key headers only | View raw
La domanda sintetica e' :
dove diavolo trovo un tutorial su "stringtemplate" e STGroup ?
(con google e su www.stringtemplate.org non l'ho proprio trovato!)
La domanda piu' specifica e' come caspita posso usare un STG con piu' campi da sostituire (attributi?)
Vorrei passare da questo :
nomeTempl(param) ::= <<
$param:{param | $\n$$\t$<td><a href='link'>$param$</a></td>}$
>>
con java:
final STGroup stGroup = new STGroupFile("templates/exampleTemplateTD1.stg",'$','$');
final ST nomeTempl = stGroup.getInstanceOf("nomeTempl");
nomeTempl.add("param", Arrays.asList(new String[]{"descr1", "descr2", "descr3"}));
ad avere anche il "link" sostituibile.
Il meglio che sono riuscito ad escogitare, dopo una valanga di tentativi, e':
nomeTempl(param,link) ::= <<
$param:{param | $\n$$\t$<td><a href='$link:{link|$link$}$' >$param$</a></td>}$
>>
con java:
final STGroup stGroup = new STGroupFile("templates/exampleTemplateTD1.stg",'$','$');
final ST nomeTempl = stGroup.getInstanceOf("nomeTempl");
nomeTempl.add("param", Arrays.asList(new String[]{"descr1", "descr2", "descr3"}));
nomeTempl.add("link", Arrays.asList(new String[]{"link1", "link2", "link3"}));
ma ottengo come output un misero:
<td><a href='link1link2link3' >descr1</a></td>
<td><a href='link1link2link3' >descr2</a></td>
<td><a href='link1link2link3' >descr3</a></td>
Ringrazio chi trovera' la pazienza di aiutarmi !
Back to it.comp.java | Previous | Next | Find similar
stringtemplate e STGroup sessantaquattrobits@gmail.com - 2015-10-08 02:14 -0700
csiph-web