Java GET、POST请求参数转实体

  • GET请求:
@RequestMapping(value = "qry", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public String getPackageList(HttpServletRequest request, HttpServletResponse response){
        PackageCustomizationVO vo = new PackageCustomizationVO();
        ServletRequestDataBinder binder = new ServletRequestDataBinder(vo);
        binder.bind(request); 
  //DO SOMETHING
  return vo.toString();
}
  • POST请求
    public String addPackage(@RequestBody PackageCustomizationVO vo){
        return vo.toString();
    }

     

你可能感兴趣的:(Java框架)