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

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

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

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

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

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

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

相关文章:

  • 2021-11-23
  • 2021-07-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2021-10-22
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2023-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案