1、采用decode()方法
页面:
- Url: '<%=path%>/sfyh/infodata.jsp?type='+encodeURI(ss)
,
后台:
- String result = java.net.URLDecoder.decode(type,"UTF-8")
2、采用设置字符集的方式
- request.setCharacterEncoding("utf-8")
3、在页面上定义charset的字符集(最有效 最简单)
- <%@ page language="java" contentType="text/html; charset=utf-8"
- pageEncoding="utf-8"%>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4、采用转码的方式
页面:
- Url: '<%=path%>/sfyh/infodata.jsp?type='+encodeURIComponent(ss)
后台:
- result= new String(request.getParameter("type").getBytes("ISO8859-1"),"UTF-8")