要在 web.xml 中配置资源引用.java:comp/env 是组件内, 你没有引用的话它就不会出现在 Web Context 中.

解决方案 »

  1.   

    我的web.xml是这样的:
    <?xml version="1.0" encoding="gb2312"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">

    <web-app>  
    <filter>
        <filter-name>ActionFilter</filter-name>
        <filter-class>school.filters.ActionFilter</filter-class>
      </filter><filter-mapping>
        <filter-name>ActionFilter</filter-name>
        <url-pattern>*.do</url-pattern>
      </filter-mapping>
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.htm</welcome-file>
      </welcome-file-list>
    </web-app>