Well, In Spring MVC, If you are using Annotation then,
As an Example,
HTML
<a href="cabBooking">Book Cab</a>
Spring Controller
@Controller
public class HomeController {
@RequestMapping(value="/cabBooking", method = RequestMethod.GET)
public ModelAndView getCabBookingPage() {
ModelAndView mnv = new ModelAndView("cabBooking"); //here it will search "cabBooking.jsp" in /WEB-INF/pages/ and same mapping you can find in dispatcher file.
Also, whatever your mapping is to invoke this function will be visible to user and actual page is what you will p
return mnv;
}
}
dispatcher file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="com.on.transport" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
Add Spring MVC Dispatcher class mapping in web.xml. Have a look at any Spring MVC example for web.xml changes.