Spring MVC Multiple View page ExampleHere, 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 MVC1. Add dependencies to pom.xml2. Create the request pageLet's create a simple jsp page containing a link. index.jsp 3. Create the controller classLet's create a controller class that returns the JSP pages. Here, we pass the specific name with a @Requestmapping annotation to map the class. HelloController.java 4. Provide the entry of controller in the web.xml fileweb.xml 5. Define the bean in the xml fileNow, 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. spring-servlet.xml 6. Create the other view componentsviewpage.jsp final.jsp Output: Next TopicMultiple Controller |