问题描述
我刚刚回答了以下有关此已发布问题的问题.
I have just answered the below question which revolves around this posted question.
spring mvc InternalResourceViewResolver没有前缀
有人可以说出课程之间的区别
Can someone out there tell the difference between the classes
org/springframework/web/servlet/ModelAndView
和 org/springframework/web/portlet/ModelAndView
我都看到了几乎相似的API文档
I see almost similar API docs for both
和
都具有构造函数
ModelAndView(String viewName)
Convenient constructor when there is no model data to expose.
而后者在解析视图时不起作用?
and yet the latter doesn't work in resolving the view?
推荐答案
忽略这两个是针对两个完全不同的环境的,不同之处在于 org.springframework.web.servlet.ModelAndView
是支持处理程序方法返回类型:
Ignoring that these two are meant for two completely different environments, the difference is that org.springframework.web.servlet.ModelAndView
is a supported handler method return type:
这意味着Spring具有 HandlerMethodReturnValueHandler
实现( ModelAndViewMethodReturnValueHandler
),它将收到类型为 ModelAndView 并对其进行处理.
That means that Spring has a HandlerMethodReturnValueHandler
implementation (ModelAndViewMethodReturnValueHandler
) that will receive the return value of type ModelAndView
and process it.
它没有默认注册的 org.springframework.web.portlet.ModelAndView
的实现.
It does not have such a implementation for org.springframework.web.portlet.ModelAndView
registered by default.
更多:
这篇关于org/springframework/web/servlet/ModelAndView类与org/springframework/web/portlet/ModelAndView之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!