3
我們一直在尋找HTML編碼我們的JSP頁面以對付XSS的方法。Java - XSS - HTML編碼 - 字符實體引用與數字實體引用
OWASP的網站顯示How_to_perform_HTML_entity_encoding_in_Java
約實體文章會談編碼 「大5」,即
21 {"#39", new Integer(39)}, // ' - apostrophe
22 {"quot", new Integer(34)}, // " - double-quote
23 {"amp", new Integer(38)}, // & - ampersand
24 {"lt", new Integer(60)}, // < - less-than
25 {"gt", new Integer(62)}, // > - greater-than
即
<script>
被編碼爲
<script>
但包括在本文中的Java代碼示例使用數字參考編碼即
<script></script>
被編碼爲
<script></script>
是否有使用過實體引用字符引用一個原因是什麼?哪個最好,爲什麼?