精华帖 (0) :: 良好帖 (0) :: 新手帖 (5) :: 隐藏帖 (2)
|
|
---|---|
作者 | 正文 |
发表时间:2010-12-30
看回复呀,回复里面不是有解决方案吗?
|
|
返回顶楼 | |
发表时间:2011-03-07
Jophy 写道 @RequestMapping(params = "method=login") public ResponseEntity<String> doFirst(@RequestParam("u") String u,@RequestParam("p") String p,HttpSession session,ModelMap model){ HttpHeaders headers = new HttpHeaders(); MediaType mt=new MediaType("text","html",Charset.forName("gbk")); headers.setContentType(mt); ResponseEntity<String> re=null; String return = new String("test"); re=new ResponseEntity<String>(return,headers, HttpStatus.OK); return re; }这样可以自定义 返回的响应头部content-type 没必要那么麻烦,直接用 @RequestMapping(params = "method=add") @ResponseBody public String add(@ModelAttribute("goodsInfo") GoodsInfoModel goodsInfo, HttpServletResponse response) throws IOException { // ... return "{success:true}"; } |
|
返回顶楼 | |
发表时间:2011-03-16
这个学习了,歇息
|
|
返回顶楼 | |
发表时间:2011-09-28
终于在此找到答案了!!感谢楼上
|
|
返回顶楼 | |