- Spring MVC Beginner’s Guide
- Amuthan G
- 161字
- 2021-07-16 11:25:44
View resolvers
We saw the purpose of the first two tags that are specified within the web application context configuration file:
<mvc:annotation-driven /> <context:component-scan base-package="com.packt.webstore" />
Based on these tags, Spring creates the necessary beans to handle a web request and also creates beans for all the @Controller
classes. However, to run a Spring MVC application successfully, Spring needs one more bean; this bean is called a view resolver.
A view resolver helps the dispatcher servlet identify the views that have to be rendered as the response for a specific web request. Spring MVC provides various view resolver implementations to identify views, and InternalResourceViewResolver
is one such implementation. The final tag in the web application context configuration is the bean definition for the InternalResourceViewResolver
class as follows:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </bean>
Through the preceding bean definition in the web application context configuration, we instruct Spring MVC to create a bean for the InternalResourceViewResolver
class (org.springframework.web.servlet.view.InternalResourceViewResolver
). We will learn more about the view resolver in Chapter 5, Working with View Resolver.
- Python數據分析入門:從數據獲取到可視化
- SQL Server 2012數據庫技術與應用(微課版)
- Mastering Ninject for Dependency Injection
- 數據化網站運營深度剖析
- Hands-On Mathematics for Deep Learning
- HikariCP連接池實戰
- Mastering LOB Development for Silverlight 5:A Case Study in Action
- 大數據技術原理與應用:概念、存儲、處理、分析與應用
- 數據中臺實戰:手把手教你搭建數據中臺
- 基于數據發布的隱私保護模型研究
- 碼上行動:利用Python與ChatGPT高效搞定Excel數據分析
- 大數據計算系統原理、技術與應用
- ORACLE 11g權威指南
- 數據庫技術與應用:SQL Server 2008
- 數據可視化五部曲