`
qingwei201314
  • 浏览: 164201 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

spring rest restful

阅读更多

1.只需引入jackson-mapper-asl(org.codehaus.jackson)包后,在controller中增加此方法,即可实现rest:

 

import im.gsj.about.vo.RestVo;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RestConstroller {
 
 @RequestMapping(value="/RestConstroller/rest.do", method=RequestMethod.GET)
 public @ResponseBody RestVo aboutUs(){
  RestVo restVo=  new RestVo();
  restVo.setId("id");
  restVo.setName("myname");
  
  return restVo;
 }
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics