- 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.
- Redis使用手冊
- Hands-On Data Structures and Algorithms with Rust
- 數(shù)據(jù)庫基礎(chǔ)與應(yīng)用:Access 2010
- SQL Server入門經(jīng)典
- Starling Game Development Essentials
- 數(shù)據(jù)庫設(shè)計(jì)與應(yīng)用(SQL Server 2014)(第二版)
- Flutter Projects
- 圖數(shù)據(jù)實(shí)戰(zhàn):用圖思維和圖技術(shù)解決復(fù)雜問題
- INSTANT Apple iBooks How-to
- 中文版Access 2007實(shí)例與操作
- Expert Python Programming(Third Edition)
- 利用Python進(jìn)行數(shù)據(jù)分析(原書第2版)
- Python 3爬蟲、數(shù)據(jù)清洗與可視化實(shí)戰(zhàn)
- Hands-On Deep Learning for Games
- PostgreSQL高可用實(shí)戰(zhàn)