step1. 添加包
          commons-collections-3.1.jar   
          commons-dbcp-1.2.1.jar   
          commons-pool-1.2.jar
          ojdbc14.jar

step2. 创建Action
           //获得servlet上下文
           ServletContext ctx = servlet.getServletContext();

           //获得数据源
           DataSource ds = (DataSource) ctx.getAttribute("DataSource"); 
           
           //获得数据连接
           Connection conn =ds.getConnection();

step4. 配置struts-config.xml
         

<struts-config>
      <data-sources>

    <data-source key="DataSource" type="org.apache.commons.dbcp.BasicDataSource">

        <set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />

        <set-property property="url" value="jdbc:oracle:thin:@localhost:1521:orcl"/>

        <set-property property="username" value="scott"/>

        <set-property property="password" value="tiger"/>

    </data-source>

</data-sources>