Monday 18 August 2008

JSP Printing Escape Characters.

During some recent developing in Java/JSP, using the c taglib, I had an issue when I wanted to print characters that JSP interprited as escape characters.

To output an attribute stored in the request I was simply using

{$myAttribute}

This worked well until the escape character came into play.

After a bit of research, I found some instructions to change the code as follows.

<c:out escapeXml='false' value='$myAttribute'/>

This now outputs the attribute exactly as it was stored.

Done.

No comments: