Bean:写过滤器不起作用

时间:2016-08-01 07:59:35

标签: xss struts-1

我正在使用Struts 1和JSP开发应用程序。我必须编写XSS保护。我有这样的输入:

<input id="name"  name="name" class="someClass" type="text" 
        value="<bean:write name="personForm" property="name"/>">

我读到为保护XSS攻击我必须在bean中添加属性过滤器:write和filter应该为true。所以我的代码现在看起来像

<input id="name"  name="name" class="someClass" type="text" 
        value="<bean:write name="personForm" property="name" filter="true"/>">

但我仍然可以提交脚本。你知道为什么会这样吗?

1 个答案:

答案 0 :(得分:1)

bean:write仅用于呈现目的。传递给服务器端的值不会被过滤。