Spring MVC Multiple View page Example
Here, we redirect a view page to another view page.
Let's see the simple example of a Spring Web MVC framework. The steps are as follows:
Directory Structure of Spring MVC
1. Add dependencies to pom.xml
2. Create the request page
Let's create a simple jsp page containing a link.
3. Create the controller class
Let's create a controller class that returns the JSP pages. Here, we pass the specific name with a @Requestmapping annotation to map the class.
4. Provide the entry of controller in the web.xml file
5. Define the bean in the xml file
Now, we also provide view resolver with view component.
Here, the InternalResourceViewResolver class is used for the ViewResolver.
The prefix+string returned by controller+suffix page will be invoked for the view component.
This xml file should be located inside the WEB-INF directory.
6. Create the other view components