How to display html snippets in Struts2

Posted by Martin Homik | Posted in Java, WebApp | Posted on 22-04-2008

7

The second problem, I solved today, was to display html snippets in Struts. These snippets were stored in a POJO. If you use the usual Struts property element for displaying data, it will escape html code. Hence, you have to turn off escaping:

  1. <s:property escape="false" value="body"></s:property>

Comments (7)

You Rock! I had the same problem and did a Google search for “struts2 escaping” and your blog was the first hit. Thanks for the answer.

You’re welcome!

[...] Es ist schon schön zu sehen, wenn mein Blog ein hohes Ranking hat. Gestern hat mir jemand einen Kommentar in meinem englischen Berufs-Blog [...]

Just had this problem and I’m all kinds of happy that I found this in less than 60 seconds. Thanks.

Thank you so much

Thank you Struts god!

Thanks for the 411 man. Your rock.

Write a comment