1:tomcat——context.xml
<Resource name="jdbc/struts" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/struts?characterEncoding=utf8"
username="root"
password="root"
maxActive="200"
maxIdle="50"
maxWait="3000"/>
2:web.xml
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/struts</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>