标签:tostring spring 后台 read stringbu private load ret let
无框架使用流获取参数:
private String getXmlString(HttpServletRequest request) { BufferedReader reader = null; String line = ""; String xmlString = null; try { reader = request.getReader(); StringBuffer inputString = new StringBuffer(); while ((line = reader.readLine()) != null) { inputString.append(line); } xmlString = inputString.toString(); } catch (Exception e) { // throw new YppException(PayException.xmlParseError); } return xmlString; }
在spring boot的中可以使用@RequestBody加上对象接收:
@RequestBody ParamUserDetail userDetail
如果不愿意构造对象的时候可以使用Map<String,String>来接收:
@RequestBody Map<String,String> params
AJAX设置content-type为:application/json提交请求,后台接收参数实现
标签:tostring spring 后台 read stringbu private load ret let
原文地址:https://www.cnblogs.com/zhaojiaxiang/p/13067533.html