I am trying to process the template (see below) and I'm getting all sorts of messages in the eclipse console.
I've searched the net but can't really find what I'm looking for. I recall seeing something on this topic here but I didn't bookmark it at the time and cannot find it again! :/
Can you please help? thanks
ps. I'm trying to construct an email message using StringTemplate. and using HTML tags for "easier reading" for our clients.
java code used to load my template
STGroup stGroup = new STGroupDir("/resources/emailTemplates", '$', '$');
ST emailBody = stGroup.getInstanceOf("Fab");
my template
<h3>Thank you for submitting your details.</h3>
Student ID: $studentId$<br />
Family Name: $familyName$<br />
Given Name: $givenName$<br />
Gender: $gender$<br />Course: $course$<br />
<h3>This is the final confirmation for MyApps Arrival Briefing (FAB).</h3>
$first$
</p><p>
$previous$
<p></p>
<p>If you have to cancel a booking please notify us by email: <a href="mailto:issu@">[email protected]</a>. <br>For booking an additional event please revisit the <a href="http://www.myapps.com/international-students/services/">ISSU website</a> and submit another booking. <br>If you have difficulties finding the venues please ask for help at ISSU. <br><br>The ISSU is located in the basement (B 10)</a> of the Union building (building 25 on the <a href="http://www.myapps.com/MyApps/app_templates/behaviours/popup.cfm?file_uuid=90DE8CF7-C571-D75A-CB7A-37DA9D470AB4&method=popup&alt=%27MyApps%20Map%20showing%20ISSU%20location_thumb.png">campus map</a>).</p>
Here's the error messages I get about my template
Fab.st 1:1: invalid character '<'
Fab.st 1:3: invalid character '>'
Fab.st 1:1: no viable alternative at input 'h3'
Fab.st 1:43: invalid character '<'
Fab.st 1:44: invalid character '/'
Fab.st 1:46: invalid character '>'
Fab.st 2:12: invalid character '$'
Fab.st 2:22: invalid character '$'
Fab.st 2:24: invalid character '<'
Fab.st 2:28: invalid character '/'
Fab.st 2:28: invalid character '>'
Fab.st 3:13: invalid character '$'
Fab.st 3:24: invalid character '$'
Fab.st 3:26: invalid character '<'
Fab.st 3:30: invalid character '/'
Fab.st 3:30: invalid character '>'
Fab.st 4:12: invalid character '$'
Fab.st 4:22: invalid character '$'
Fab.st 4:24: invalid character '<'
Fab.st 4:28: invalid character '/'
Fab.st 4:28: invalid character '>'
Fab.st 5:8: invalid character '$'
Fab.st 5:15: invalid character '$'
Fab.st 5:17: invalid character '<'
Fab.st 5:21: invalid character '/'
Fab.st 5:21: invalid character '>'
Fab.st 5:30: invalid character '$'
Fab.st 5:37: invalid character '$'
Fab.st 5:39: invalid character '<'
Fab.st 5:43: invalid character '/'
Fab.st 5:43: invalid character '>'
Fab.st 6:1: invalid character '<'
Fab.st 6:3: invalid character '>'
Fab.st 6:72: invalid character '<'
Fab.st 6:73: invalid character '/'
Fab.st 6:75: invalid character '>'
Fab.st 7:0: invalid character '$'
Fab.st 7:6: invalid character '$'
Fab.st 8:1: invalid character '<'
Fab.st 8:2: invalid character '/'
Fab.st 8:3: invalid character '>'
Fab.st 8:5: invalid character '<'
Fab.st 8:6: invalid character '>'
Fab.st 9:0: invalid character '$'
Fab.st 9:9: invalid character '$'
Fab.st 10:1: invalid character '<'
Fab.st 10:2: invalid character '>'
Fab.st 10:4: invalid character '<'
Fab.st 10:5: invalid character '/'
Fab.st 10:6: invalid character '>'
Fab.st 11:1: invalid character '<'
Fab.st 11:2: invalid character '>'
Fab.st 11:63: invalid character '<'
Fab.st 11:99: invalid character '>'
Fab.st 11:121: invalid character '<'
Fab.st 11:122: invalid character '/'
Fab.st 11:123: invalid character '>'
Fab.st 11:127: invalid character '<'
Fab.st 11:129: invalid character '>'
Fab.st 11:182: invalid character '<'
Fab.st 11:250: invalid character '>'
Fab.st 11:264: invalid character '<'
Fab.st 11:265: invalid character '/'
Fab.st 11:266: invalid character '>'
Fab.st 11:297: invalid character '<'
Fab.st 11:299: invalid character '>'
Fab.st 11:374: invalid character '<'
Fab.st 11:376: invalid character '>'
Fab.st 11:378: invalid character '<'
Fab.st 11:380: invalid character '>'
Fab.st 11:420: invalid character '1'
Fab.st 11:421: invalid character '0'
Fab.st 11:424: invalid character '<'
Fab.st 11:425: invalid character '/'
Fab.st 11:426: invalid character '>'
Fab.st 11:460: invalid character '2'
Fab.st 11:461: invalid character '5'
Fab.st 11:471: invalid character '<'
Fab.st 11:678: invalid character '>'
Fab.st 11:690: invalid character '<'
Fab.st 11:691: invalid character '/'
Fab.st 11:692: invalid character '>'
Fab.st 11:696: invalid character '<'
Fab.st 11:697: invalid character '/'
Fab.st 11:698: invalid character '>'
StringTemplate 4 uses a new format for loose templates (*.st
files) so they perform better with the new parameter passing scheme used in the internal bytecode representation. Template files which used to look like this:
example.st (version 3)
Student ID: $studentId$<br />
Family Name: $familyName$<br />
Given Name: $givenName$<br />
Would now look like this:
example.st (version 4)
example(studentId, familyName, givenName) ::= <<
Student ID: $studentId$<br />
Family Name: $familyName$<br />
Given Name: $givenName$<br />
>>
If you don't want to alter your templates to include the prototypes, you can use STRawGroupDir
instead of STGroupDir
, which was added in ST 4.0.5.
This is the link that tells how to ensure html entities are escape in string template, What is the best way to ensure HTML entities are escaped in StringTemplate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With