SpringMVC定义了一个名为ViewResolver的接口:
public interface ViewResolver{
View resolverViewName(String viewName, Locale locale) throws Exception;
}
View接口:
public interface View{
String getContentType();
void render(Map<String, ?> model,
HttpServletRequest request,
HttpServletResponse response) throws Exception;
}
Spring自带了13个视图解析器,能够将逻辑视图名转换为物理实现: