Hi all,
I'm having issues escaping the Velocity-like parts of a script properly.
I am trying to generate JSP files, and with the use of JSTL and JSP
EL, a JSP looks a LOT like a Velocity script.
Here's the original text I wanted to escape, in JSP syntax:
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8"%>
<[EMAIL PROTECTED] prefix="t" tagdir="/WEB-INF/tags"%>
<t:story category="<<<id>>>" id="${param.id}"/>
<t:page title="<<<title>>>" section="<<<section>>>">
${story.properties['html'].value}
</t:page>
The <<<>>> delimited bits are what I want to replace with Velocity.
I tried simply:
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8"%>
<[EMAIL PROTECTED] prefix="t" tagdir="/WEB-INF/tags"%>
<t:story category="$category" id="\${param.id}"/>
<t:page title="$title" section="$section">
\${story.properties['html'].value}
</t:page>
But Velocity complained about the ['html'] section, giving me a
syntax error.
So, I tried:
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8"%>
<[EMAIL PROTECTED] prefix="t" tagdir="/WEB-INF/tags"%>
<t:story category="$page.properties.category.intValue" id="\$
{param.id}"/>
<t:page title="$page.title" section="$page.properties.section">
\$\{story.properties['html'].value\}
</t:page>
But when I render the script, I get all of the \ in the script
output. It looks like this:
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8"%>
<[EMAIL PROTECTED] prefix="t" tagdir="/WEB-INF/tags"%>
<t:story category="46051" id="\${param.id}"/>
<t:page title="Test Page" section="testsection">
\$\{story.properties['html'].value\}
</t:page>
So, I'm kind of stuck. I thought I was escaping things properly, but
apparently not as I'm not getting out what I expect.
Is there a routine somewhere that will take raw text and convert it
in to a valid Velocity script the recreates the original text? That
would be a great help.
I saw the EscapeTool, but it handles a bunch of languages, but not
Velocity itself.
Does anyone have any examples?
Any help would be appreciated.
Regards,
Will Hartung
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]