SpringMVC
For creating spring MVC there are five steps:
1) Configure the dispatcher servlet in the web.xml
<servlet>2) Create spring configuration file e.g spring-servlet.xml
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
--The starting name of spring configuration file should be same as servlet-name above: spring
and the servlet behind.
3) Configure view resolver, it will be declare as bean inside spring configuration file.
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" name="viewResolver">4)Give suffix and prefix property to internal resource view resolver
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
5)Create controller and user <context:component-scan base-package="com.mountech"/>
Comments
Post a Comment