Spring + hibernate + springmvc integration (2)

Source: Internet
Author: User

2. integrate Spring

A) web. xml file configuration

<Context-param> <param-Name> webapprootkey </param-Name> <param-value> webapp. root </param-value> </context-param> <param-Name> contextconfiglocation </param-Name> <param-value>/WEB-INF/applicationcontext *. XML, classpath *: applicationcontext *. XML, classpath *: prediction_config.xml </param-value> </context-param> <! -- Log4j config ------- the webapp must be defined before spring context listener or above. root environment variables cannot be used in the log4j configuration file --> <listener-class> Org. springframework. web. util. log4jconfiglistener </listener-class> </listener> <! -- Spring applicationcontext loading --> <listener-class> org. springframework. Web. Context. contextloaderlistener </listener-class> </listener> <! -- Character encoding filter --> <filter-Name> encodingfilter </filter-Name> <filter-class> Org. springframework. web. filter. characterencodingfilter </filter-class> <init-param> <param-Name> encoding </param-Name> <param-value> UTF-8 </param-value> </init- param> <init-param> <param-Name> forceencoding </param-Name> <param-value> true </param-value> </init-param> </Filter> <filter-mapping> <filter-Name> Encodingfilter </filter-Name> <URL-pattern>/* </url-pattern> </filter-mapping> <! -- Spring refresh introspector to prevent memory leakage --> <listener-class> org. springframework. Web. util. introspectorcleanuplistener </listener-class> </listener>

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.