[stringtemplate-interest] Problem with ST 4.0.3

Christophe Roudet croudet at gmail.com
Wed Jun 22 14:49:46 PDT 2011


Hello,

I have just upgraded to ST v4.0.3 and I have a template that was
working with 4.0.2 that no longer works
So have a template file:
ae.st:
ae(triggerUserList) ::= <<
    <triggerUserList:{u | <u>}>
>>

some test code:

 STGroup group = new STGroupDir("conf/emailTemplates");
  ST st = group.getInstanceOf("/html/ae");
  List<User> users = new ArrayList<User>();
  User u = new User();
  u.setUsername("u1");
  u.setEmail("u1 at email.com");
  users.add(u);
  u = new User();
  u.setUsername("u2");
  u.setEmail("u2 at email.com");
  users.add(u);
  st.add("triggerUserList", users);
  System.out.println(st.render());

I have some trace on the console:
context [/html/ae] 1:7 no such template: /html/_sub1
context [/html/ae] 1:23 passed 1 arg(s) to template null with 0 declared arg(s)
context [/html/ae] 1:7 passed 1 arg(s) to template null with 0 declared arg(s)
context [/html/ae] 1:7 passed 1 arg(s) to template null with 0 declared arg(s)

A similar template build like this works fine:
 STGroup g = new STGroup('$', '$');
  g.defineTemplate("test", "triggerUserList", "$triggerUserList:{u |
$u.username$ ($u.email$)}; separator=\", \"$");
  ST st = g.getInstanceOf("test");

Any idea,?

thanks,

Christophe


More information about the stringtemplate-interest mailing list