今天做分页功能遇到这样子的问题:
表单用get方法传含有"%"字符参数,返回页面的链接中包含该参数,点击该链接出现:
org.apache.tomcat.util.http.Parameters processParameters
Warning: Parameters: Character decoding failed. Parameter skipped.
java.io.CharConversionException: EOF
当get方式提交表单时 "%"会被转换成"%25",而在把参数写回页面的链接时,并没有做相关的encode.
另外发现Firefox和IE的状态栏显示的url有点不同:
在Firefox中,状态栏提示的url是不是a标签中href的字面值,应该经decode过的url,
而在IE中,状态栏提示的就是a标签中href的字面值。
如同样的 <a href="http://localhost:8080/a/action.do?name=%251&p=2">test encoding</a>
在FireFox的状态栏显示的是: http://localhost:8080/a/action.do?name=%1&p=2,
在IE中是:http://localhost:8080/a/action.do?name=%251&p=2
当然,点击该链接,地址栏中的地址都就是http://localhost:8080/a/action.do?name=%251&p=2一样的了。