Spring MVC Multiple Controller Example
In Spring MVC, we can create multiple controllers at a time. It is required to map each controller class with @Controller annotation. Here, we see a Spring MVC example of multiple controllers. 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 two links.
3. Create the controller class
Let's create two controller classes, where each returns the particular view page.
4. Provide the entry of controller in the web.xml file
5. Define the bean in the xml file
6. Create the other view components