如何在Spring中的请求参数中发送特殊字符

如何处理请求参数中的特殊字符? 这是我的控制器:

@Scope("request") @RestController public class GetOperatorSeries{ @RequestMapping(value = "test", method = RequestMethod.GET) public String getOperatorSeries(HttpServletResponse response, @RequestParam(value = "mobno") long mobno, @RequestParam(value = "sourceType") String sourceType, @RequestParam(value = "responseType") String responseType) { } 

例如,如果我在请求参数中使用任何特殊字符,则它不会读取它,就像我发送“sourceType = @ $ abc”那样它会将其读为null或为空。 但我希望它也应该读特殊字符。

您需要对请求参数进行编码。

请查看此链接以获取列表: http : //www.w3schools.com/tags/ref_urlencode.asp

这来回转换: http : //meyerweb.com/eric/tools/dencoder/