1.从页面传参至后台,使用
<script type="text/javascript">
function selectdept(id,name,type){
var i=window.encodeURIComponent?encodeURIComponent:escape;
var curname=i(name);
mypage="<%=basePath%>/knowledge/commontable/commontable_checkdept.jsp? name="+curname+"&id="+id+"&type="+type;
window.open(mypage,"_blank","width=380,height=350,left=350,top=150,scrollbars=no,resizable=no");
}
</script>
2.在servlet中
String comment=request.getParameter("comment");
String fileName=request.getParameter("name");
String id=request.getParameter("id");
try {
request.setCharacterEncoding("utf-8");
comment = new String(comment.getBytes("iso-8859-1"),"utf-8");
fileName = new String(fileName.getBytes("iso-8859-1"),"utf-8");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
3.在页面中使用UTF-8编码