Spring MVC JSP View Resolver Example

Spring MVC JSP View Resolver is a way to configure the jsp view names using the org.springframework.web.servlet.view.InternalResourceViewResolver.

InternalResourceViewResolver has 2 properties that are very useful
1. prefix
2. suffix.

These 2 properties help in determining the complete path of the view.

Lets see steps to configure the jsp view resolver.

1. Dispatcher servlet

2. Controller

Output

The dispatcher servlet has prefix as WEB-INF and suffix as .jsp, so when the controller returns the string as home, it will search for the file WEB-INF/home.jsp and if it finds the file, then it will display that jsp.

Spring MVC Jsp View Resolver

Download Full Code – SpringMVC-JspViewResolver.zip

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn