特殊字符亂碼問題

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形式傳參

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章