window.location.href 中文乱码问题。。。。

要解决此问题需要两次解码,

  第一次解码:

    是在页面中的js脚本中解码:window.location.href = "saveCl.action?clflname="+encodeURI(encodeURI(clflname)) ;

  第二次解码:

    是在Java程序中进行二次解码:String clflname1 = java.net.URLDecoder.decode(clflname, "UTF-8");

此时经过两次解码之后,从页面传过来的clflname解码之后变为clflname1,此时clflname1就是中文了

时间: 2024-07-29 19:59:49

window.location.href 中文乱码问题。。。。的相关文章

window.location.href传参中文乱码问题

window.location.href="${pageContext.request.contextPath}/story/exportStoryInfo?domainId="+domainIds                                                +"&requirementName="+requirementName; 前端页面需求名称输入"4.19活动",传递到后台时出现中文乱码问题: 解

window.location.href url含中文服务器收到乱码问题解决

中文乱码问题 window.location.href url含中文服务器收到乱码问题解决 (1).页面中先对中文进行编码. 如:window.location.href = url+"&groupName=" + encodeURI(encodeURI(groupName)) ; 注意,页面部分需要编码两次. (2).在服务端进行解码.   groupName= java.net.URLDecoder.decode(groupName, "UTF-8");

window.location.href url含中文乱码问题

(1).页面中先对中文进行编码. 如:window.location.href = url+"&groupName=" + encodeURI(encodeURI(groupName)) ; 注意,页面部分需要编码两次. (2).在服务端进行解码.  groupName= java.net.URLDecoder.decode(groupName, "UTF-8"); (3).如果是在jsp页面接收 var groupName= decodeURI('<

关于js中window.location.href,location.href,parent.location.href,top.location.href的用法

关于js中window.location.href,location.href,parent.location.href,top.location.href的用法 "window.location.href"."location.href"是本页面跳转. "parent.location.href" 是上一层页面跳转. "top.location.href" 是最外层的页面跳转. 举例说明: 如果A,B,C,D都是html,D

window.location.href和window.location.replace的区别

在页面中逐级进行点击请求以下页面:a.html->b.html->c.html window.location.href 做跳转 window.history.go(-1);window.history.back(); 方法时,会向服务器进行请求,根据服务器记录的请求进行跳转,因此会正确返回对应的页面a.html. window.location.replace 做跳转 window.history.go(-1);window.history.back(); 方法时,不会向服务器进行请求,因此

关于js中window.location.href,location.href,parent.location.href,top.location.href用法

"window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一层页面跳转 "top.location.href"是最外层的页面跳转 举例说明: 如果A,B,C,D都是jsp,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js这样写 "window.location.href"."locatio

window.location.href的用法

在写ASP.Net程序的时候,我们经常遇到跳转页面的问题,我们经常使用Response.Redirect 做ASP.NET框架页跳转,如果客户要在跳转的时候使用提示,这个就不灵光了,如: Response.Write("< script>alert('恭喜您,注册成功!');< /script>");   Response.Redirect("main.html");    这时候我们的提示内容没有出来就跳转了,和Response.Redir

window location href 刷新

页面刷新类型: 1.window.location.reload 刷新. window.location.reload()与window.location.href=window.location.href都可以刷新页面. 注: window.location.reload()刷新页面时,页面若有数据提交会提示是否提交数据,就是我们经常看到的那个讨厌的提示框.window.location.href=window.location.href则不会. 2.frame框架刷新. 代码如下: <htm

5. window.location.href/replace/reload()--页面跳转+替换+刷新

1.window.location=url; window.location 对象用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面. 一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pageContext.request.contextPath}/Login_goBack"); ===================================================================