I want to prevent xss attacks in my spring application.
I added
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>
into my web.xml (I found this soulution here)
but on my page I save content with name <script>alert(1);</script>
and this scripts executes after page refresh.
client side code:
$.ajax({
type: 'POST',
url: 'setContentName',
dataType: 'json',
data: {contentId: id, name: params.value}
});
What do I wrong?
P.S.
I load content using javascript after refresh