你的位置:首页 > 软件开发 > ASP.net > Spring SpringMvc 3.0 + MyBatis 整合

Spring SpringMvc 3.0 + MyBatis 整合

发布时间:2015-08-11 09:00:10
一、使用的jar包就不详细讲解了,下载了Mybatis 和 Spring 的jar包基本上都添加上去了、一图概括:(这是我使用的ar包,有些不是Mybatis 和 Spring 的 ) 二、 web.[html] view plaincopy<?<web ...

一、使用的jar包就不详细讲解了,下载了Mybatis 和 Spring 的jar包基本上都添加上去了、

一图概括:(这是我使用的ar包,有些不是Mybatis 和 Spring 的 ) Spring SpringMvc 3.0 + MyBatis 整合

 

二、 web.

[html] view plaincopySpring SpringMvc 3.0 + MyBatis 整合Spring SpringMvc 3.0 + MyBatis 整合

  1. <?

  2. <web-app 

  3.     

  4.     xsi:schemaLocation="http://java.sun.com/

  5.     id="WebApp_ID" version="2.5">  

  6.     <display-name>WeShare</display-name>  

  7.     <welcome-file-list>  

  8.         <welcome-file>/jumper.html</welcome-file>  

  9.     </welcome-file-list>  

  10.     <!-- 加载spring容器配置 -->  

  11.     <listener>  

  12.         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  

  13.     </listener>  

  14.     <!-- 设置Spring容器加载配置文件路径 (主要配置都在这里面) -->  

  15.     <context-param>  

  16.         <param-name>contextConfigLocation</param-name>  

  17.         <param-value>/WEB-INF/applicationContext.

  18.   </param-value>  

  19.     </context-param>  

  20.   

  21.     <!-- 配置Spring核心控制器 -->  

  22.     <servlet>  

  23.         <servlet-name>web</servlet-name>  

  24.         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  

  25.         <!-- 不指定 <init-param> 会自动找web.

  26.         <!--   

  27.         <init-param>   

  28.             <param-name>contextConfigLocation</param-name>   

  29.             <param-value>/WEB-INF/dispatcher.

  30.         </init-param>   

  31.             -->  

  32.         <load-on-startup>1</load-on-startup>  

  33.     </servlet>  

  34.     <servlet-mapping>  

  35.         <servlet-name>web</servlet-name>  

  36.         <url-pattern>*.do</url-pattern>  

  37.     </servlet-mapping>  

  38.     <servlet-mapping>  

  39.         <servlet-name>web</servlet-name>  

  40.         <url-pattern>*.action</url-pattern>  

  41.     </servlet-mapping>  

  42.   

  43.   

  44.     <!-- 解决工程编码过滤器 -->  

  45.     <filter>  

  46.         <filter-name>characterEncodingFilter</filter-name>  

  47.         <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>  

  48.         <init-param>  

  49.             <param-name>encoding</param-name>  

  50.             <param-value>UTF-8</param-value>  

  51.         </init-param>  

  52.     </filter>  

  53.     <filter-mapping>  

  54.         <filter-name>characterEncodingFilter</filter-name>  

  55.         <url-pattern>/*</url-pattern>  

  56.     </filter-mapping>  

  57.   

  58.   <!-- dwr 添加配置  -->  

  59.   <servlet>  

  60.         <servlet-name>dwr-invoker</servlet-name>  

  61.         <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>  

  62.         <init-param>  

  63.             <description></description>  

  64.             <param-name>debug</param-name>  

  65.             <param-value>false</param-value>  

  66.         </init-param>  

  67.     </servlet>  

  68.   <servlet-mapping>  

  69.        <servlet-name>dwr-invoker</servlet-name>  

  70.        <url-pattern>/dwr/*</url-pattern>  

  71.     </servlet-mapping>  

  72.   

  73.   

  74.     <error-page>  

  75.         <exception-type>java.lang.Throwable</exception-type>  

  76.         <location>/common/jsp/error.jsp</location>  

  77.     </error-page>  

  78.     <error-page>  

  79.         <error-code>403</error-code>  

  80.         <location>/common/jsp/error403.jsp</location>  

  81.     </error-page>  

  82.     <error-page>  

  83.         <error-code>404</error-code>  

  84.         <location>/common/jsp/error404.jsp</location>  

  85.     </error-page>  

  86.   

  87. </web-app>  


 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:Spring SpringMvc 3.0 + MyBatis 整合

关键词:Spring

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录