Spring + hibernate + springmvc integration (6)

Source: Internet
Author: User

3,Spring MVCConfiguration

A)Web. xmlFile

<! -- Spring MVC --> <servlet-Name> DMT </servlet-Name> <servlet-class> Org. springframework. web. servlet. dispatcherservlet </servlet-class> <init-param> <param-Name> contextconfiglocation </param-Name> <param-value>/WEB-INF/*-servlet. XML </param-value> </init-param> <load-on-startup> 0 </load-on-startup> </servlet> <servlet-mapping> <Servlet -Name> DMT </servlet-Name> <URL-pattern> *. DO </url-pattern> <! -- Match the redirection suffix --> </servlet-mapping> B) Dmt-serverlet.xml file <context: component-scan base-package = "com. HB "use-default-filters =" false "> <context: Include-filter expression =" org. springframework. stereotype. controller "type =" annotation "/> </Context: component-scan> <Bean class =" org. springframework. web. servlet. MVC. annotation. defaultannotationhandlermapping "/> <Bean class =" org. springframework. web. servlet. MVC. an Notation. annotationmethodhandleradapter "lazy-init =" false "/> <bean id =" viewresolver "class =" org. springframework. web. servlet. view. internalresourceviewresolver "> <property name =" viewclass "value =" org. springframework. web. servlet. view. jstlview "/> <property name =" prefix "value ="/WEB-INF/JSP/"/> <property name =" suffix "value = ". JSP "/> </bean> <! -- URL Mapping and parametermethod in XML mode must be configured with simplecontrollerhandleradapter after being integrated into annotation MVC --> <bean id = "urlmapping" class = "org. springframework. web. servlet. handler. beannameurlhandlermapping "> <property name =" order "value =" 1 "> </property> </bean> <Bean class =" org. springframework. web. servlet. MVC. simplecontrollerhandleradapter "/> <bean id =" methodnameresolver "class =" org. springframework. web. servlet. MVC. multiaction. parametermethodnameresolver "> <property name =" paramname "value =" method "/> <property name =" defaultmethodname "value =" Index "/> </bean>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.