Jsp中代码为<a href="download.action?inputPath=<s:property value="link"/>">,其中<s:property value="link"/>为中文时在action里无法正确接受,取到的值为一大串问号。。。百度了说用URLEncode没能够解决。。求大神支招。。初学jsp希望能有完整的代码,谢谢
------解决思路----------------------
是不是可以在获取后转一下码,String inputPath =new String(inputPath.getBytes(iso-8859-1),"gb2312");
------解决思路----------------------
String inputPath =new String(<s:property value="link"/>">.getBytes(gb2312),"iso-8859-1")
先转再传,直接传和这个意思一样
<a href="download.action?inputPath=<s:property value="inputPath"/>">
收到以后转回来
String inputPath =new String(<s:property value="link"/>">.getBytes(iso-8859-1),"gb2312")
------解决思路----------------------
一定主意在前台用两次encodeURI
------解决思路----------------------
现在tomcat服务器加URLEncoding=“utf-8”,如果不行就自己在后台获取值之后进行转吧
String inputPath =new String(inputPath.getBytes(iso-8859-1),"utf-8");