加载Spring的 Web.xml配置

想做一个小项目,在网上收集了一些资料

----------

  1. <?xml version="1.0" encoding="UTF-8"?>   
  2. <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">   
  3.   <!-- log4j在spring中的配置 -->   
  4.   <!--然后加上这个Spring的Log4j侦听类,注意在JBOSS里面,不需要这个类,注释掉,不然会冲突,-->   
  5.     <listener>   
  6.         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>   
  7.     </listener>   
  8.     <!--webAppRootKey 属性为webApp.root 代表webApp的根目录,这样就能在properties文件中定义-->   
  9.     <!-- 这里的webApp是http://localhost:8080/webApp/ -->   
  10.     <context-param>   
  11.         <param-name>webAppRootKey</param-name>   
  12.         <param-value>webApp.root</param-value>   
  13.     </context-param>   
  14.     <!--log4jConfigLocation 属性代表log4j.properties文件的地址-->      
  15.     <!-- log4j.appender.file.File=${webApp.root}/WEB-INF/logs/subject.log  -->   
  16.     <context-param>   
  17.         <param-name>log4jConfigLocation</param-name>   
  18.         <param-value>/WEB-INF/log4j.properties</param-value>   
  19.     </context-param>      
  20.  <!--  -->   
  21.   <listener>   
  22.   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>   
  23.  </listener>   
  24.  <context-param>   
  25.   <param-name>contextConfigLocation</param-name>   
  26.   <param-value>/WEB-INF/spring-config.xml</param-value>   
  27.  </context-param>     
  28.         
  29.   <!-- servlet映射-->      
  30.   <servlet>   
  31.     <description>This is the description of my J2EE component</description>   
  32.     <display-name>This is the display name of my J2EE component</display-name>   
  33.     <servlet-name>InitParameter</servlet-name>   
  34.     <servlet-class>com.gridit.qe.servlet.InitParameter</servlet-class>   
  35.   </servlet>   
  36.   <servlet-mapping>   
  37.     <servlet-name>InitParameter</servlet-name>   
  38.     <url-pattern>/servlet/InitParameter</url-pattern>   
  39.   </servlet-mapping>     
  40.        
  41. <!-- 指定JNDI JDBC DataSource -->   
  42.   <resource-ref>   
  43.     <description>JNDI JDBC DataSource</description>   
  44.     <res-ref-name>jdbc/jndidemo</res-ref-name>   
  45.     <res-type>javax.sql.DataSource</res-type>   
  46.     <res-auth>Container</res-auth>   
  47.   </resource-ref>      
  48.       
  49. </web-app>   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值