url 传参数中文乱码

1.设置页面的编码

  <%@ page contentType="text/html;charset=utf-8" %>

2.转码

  传参数时转码:java.net.URLEncoder.encode(param,"utf-8");

  例如:<a href="ds.jsp?url=<%=java.net.URLEncoder.encode("编码的是这里","utf-8")%>">点击这里</a>

3.解码

     取值时用语句:java.net.URLDecoder.decode(param,"utf-8");

posted @ 2013-07-25 14:22  xyun  阅读(197)  评论(0)    收藏  举报