You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by smadirondack <sm...@gmail.com> on 2012/06/17 08:11:25 UTC
Java method that generates html tags is escaping angle brackets...
>From a Velocity template I call a java method that generates html tags
<area shape="rect" href="http://test.com/mylink" />
But it encodes so the page ends up with the following
<area shape="rect" href="http:.....
Here's part of the template:
#set($myLinks=$reportTool.getImageMapLinks($report))
$myLinks
In the java method I just use StringBuilder with its append method and
return the toString like the following:
StringBuilder sb = new StringBuilder();
sb.append("<area shape=\"rect\" href=\"http://test.com/mylink\" />");
return sb.toString();
What can I do so that the generated html is not encoded?
Thanks
--
View this message in context: http://old.nabble.com/Java-method-that-generates-html-tags-is-escaping-angle-brackets...-tp34024803p34024803.html
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Re: Java method that generates html tags is escaping angle brackets...
Posted by Nathan Bubna <nb...@gmail.com>.
This is not a standard behavior. Either your $reportTool class is
doing it or else you have the EscapeHtmlReference EventHandler
configured.
On Sat, Jun 16, 2012 at 11:11 PM, smadirondack <sm...@gmail.com> wrote:
>
> From a Velocity template I call a java method that generates html tags
>
> <area shape="rect" href="http://test.com/mylink" />
>
> But it encodes so the page ends up with the following
>
> <area shape="rect" href="http:.....
>
> Here's part of the template:
>
> #set($myLinks=$reportTool.getImageMapLinks($report))
> $myLinks
>
> In the java method I just use StringBuilder with its append method and
> return the toString like the following:
>
> StringBuilder sb = new StringBuilder();
> sb.append("<area shape=\"rect\" href=\"http://test.com/mylink\" />");
> return sb.toString();
>
>
> What can I do so that the generated html is not encoded?
>
> Thanks
> --
> View this message in context: http://old.nabble.com/Java-method-that-generates-html-tags-is-escaping-angle-brackets...-tp34024803p34024803.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org