First, the parameter binding
Parameters automatically bind Model class data]
Application springMVC, if used ModelAndView, Model, ModelMap method in parameters of the controller as a parameter, springMVC automatically creates a data model objects.
Second, the data model
[Model] [Model + View View data / user]
Model Model: for a place to store data . View View: shows users.
View View: springMVC view into logical in view PDF view + JSON view + Excel view + JSTL View and non-logical view.
- = Logical view requires view resolver (ViewResolver) is positioned. Find a view, the data model rendering show. Return a string such as targeting jsp.
- = Non logical view no need to locate the position of the view, rendering directly.
View Interface: Get Response Type + Render
public interface View{
//响应状态属性
String RESPONSE_STATUS_ATTRIBUTE = View.class.getName() + ".responseStatus";
//路径变量
String PATH_VARIABLES = View.class.getName() + ".pathVariables";
//选择内容类型
String SELECTED_CONTENT_TYPE = View.class.getName() + ".selectedContentType";
//HTTP响应类型 获取HTTP响应类型,可以是文本、JSON、文件。
String getContentType();
//渲染方法 将数据模型渲染到视图。
void render(model,request,response);
}