Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Struts2 property tag. Force to escape single quote

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.

like image 435
Capacytron Avatar asked Dec 26 '10 11:12

Capacytron


1 Answers

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"/>
like image 116
Steven Benitez Avatar answered Oct 16 '22 18:10

Steven Benitez