A key difference between a traditional MVC controller and the RESTful web service controller shown earlier is the way that the HTTP response body is created. Rather than relying on a view technology to perform server-side rendering of the greeting data to HTML, this RESTful web service controller populates and returns a Greeting object. The object data will be written directly to the HTTP response as JSON.
一个是MVC
一个是REST
两者的Controller有啥不同呢?
最大的不同是:REST是只返回一个Response 以JSON的格式,而MVC则是在服务器端有个View Engine,负责渲染数据到这个试图模板。
我是糊涂了,都不知道该怎么写一个按钮了,郁闷中。三个礼拜了,还晕着呢。

本文探讨了传统MVC控制器与RESTful Web服务控制器之间的主要差异。关键区别在于RESTful控制器直接以JSON格式返回对象数据,而MVC控制器依赖视图技术在服务器端渲染数据到HTML。对于开发者来说,理解这种差异对于构建合适的Web服务至关重要。
9098

被折叠的 条评论
为什么被折叠?



