Spring mvc3.0 rest风格 Spring mvc 配合velocity并使用JSON(三)
之前 一篇文章 讲 Spring mvc3.0 rest风格 Spring mvc 配合velocity (二)
现在讲我在接触spring mvc+velocity+json并且是restful风格,碰到的一些问题
主要就是一个请求路径的问题,rest风格带来了不少的麻烦
本来我们如果使用简单的*.do请求方式,很容易就能实现 json
<bean p:order="1">????????
?
?
虽然我没有看他的具体源码,我猜测(仅仅是猜测,各位大侠可以拍板)顾名思义mappingJacksonHttpMessageConverter
应该将http response转换为了json数据类型返回给客户端
这样配置之后 ContentNegotiatingViewResolver 就无需配置
直接配置viewResolver 是velocity即可
?
?
?
刚刚看了一下spring官网 ,有另外一种方法可以达到restful的效果,用起来还比较简单,也无需配置
?the
@Controller
mechanism also allows you to create RESTful Web sites and applications, through the@PathVariable
annotation and other features.