Puppet template tags and Java JSP tags

302 views
Skip to first unread message

Yanis Guenane

unread,
Jul 21, 2012, 10:02:50 PM7/21/12
to puppet...@googlegroups.com
Hi All,

I was trying to templatize some JSP page I would like to dynamically generates but it looks like puppet doesn't like it.

Common JSP tags are <% ... %> so I guess it's getting confused between regular tags and jsp's one.

This is an example of the trace it is givin me :

/etc/puppet/modules/xxx/templates/webapps/xxx/yyy/Mantle.jsp:1:in `result': compile error (SyntaxError)
/etc/puppet/modules/xxx/templates/webapps/xxx/yyy/Mantle.jsp:1: syntax error, unexpected tIDENTIFIER, expecting $end

Is there any know way to deal with JSP pages ?

Thanks all,

Felix Frank

unread,
Jul 23, 2012, 3:26:27 AM7/23/12
to puppet...@googlegroups.com
Hi,
I don't know of a simple way. You probably need to escape all JSP tags
(which doesn't seem to be worth the hassle, really ;)

Cheers,
Felix

jcbollinger

unread,
Jul 23, 2012, 8:57:13 AM7/23/12
to puppet...@googlegroups.com

ERB is the Ruby analog to the templating aspects of JSP, even sporting overlapping syntax (as you discovered).  If you must create a JSP page by processing a template with ERB, then any literal JSP tag delimiters in the ERB template must be escaped.  The Ruby docs for class ERB give the syntax: <%% maps to <%, and %%> maps to %>.

You'll have to decide whether that's worthwhile, or whether to look for a better way.  For sure, if there are many JSP tags or much scriptlet code in your JSP, then it is already difficult enough to read and maintain before you convert it into an ERB template.


John

Yanis Guenane

unread,
Jul 24, 2012, 11:36:06 AM7/24/12
to puppet...@googlegroups.com
Thanks a lot to both of you. Effectively, escaping the JSP opening tag with <%% made the trick.

The closing tag needs not to be closed. It is not interpreted in anyway.

@John : Thanks for the complementaries informations to do it with ERB.
Reply all
Reply to author
Forward
0 new messages