1、使用标签
建议用(标签可以控制转换特殊字符):
<html:text property=“instruction” readonly=“true” styleClass=“mylongreadonly” size=“32”/>
<input name=“instruction” type=“hidden” value="<mycim2:write name=“object” property=“instruction” filter=“true”/>" >
<input name=“instruction” type=“hidden” value="<bean:write name=“object” property=“instruction” filter=“true”/>" >
不建议用:
<input name=“instruction” type=“hidden” value="<%=request.getAttribute(“instruction”)%>" >
强烈反对不用input,直接用<%=request.getAttribute(“instruction”)%> 或 ${instruction}
2、尽量不用url直接传字符串参数,如果要用,可以使用encodeURIComponent()等对参数进行编码
3、使用post请求,非url形式传参

本文探讨了安全编码的重要原则,包括推荐使用特定标签控制特殊字符,避免URL直接传递字符串参数,以及优先采用POST请求而非GET。这些策略有助于防止跨站脚本(XSS)攻击和其他安全漏洞。
2606

被折叠的 条评论
为什么被折叠?



