Take the 2-minute tour ×

I have rather silly problem. Struts2 property tag doesn't escape single quote ('). Such behavior breaks my JavaScript code. It does do escape double quote (") using html entities, but not single quote ('). Is there any possibility to force property tag to replace single quote with appropriate html entity?

Example, string replaced with html entities. Отредактированное событие с кавычкой "

The same with single qoute: Отредактированное событие с кавычкой '

Is there any possibility to overcome such difficulty using standard approach? I wouldn't like to write some custom code.

share|improve this question

1 Answer 1

up vote 12 down vote accepted

You're in luck! By default, the tag only escapes HTML, but you can have it escape JavaScript too:

<s:property value="yourValue" escapeJavaScript="true"/>
share|improve this answer
That's pretty awesome. –  Quaternion Dec 27 '10 at 23:37

Your Answer


