如何传超长的字符串到后台

我采用的方式是url编码,解码。

js代码中写:对一个字符串参数  

编码用:encodeURIComponent(你要编码的字符串);

解码用:decodeURIComponent(你要解码的字符串也就是你编码过的字符串);

java后台对前台编码的字符串解码需要你在前台编码两次,即:

encodeURIComponent(encodeURIComponent(你要编码的字符串));

后台解码:java.net.URLDecoder.decode("前台进行过两次编码的字符串","UTF-8");

posted @ 2017-07-20 20:10  鄒成立  阅读(2680)  评论(2编辑  收藏  举报