在conf\Catalina\localhost目录下添加myweb.xml文件,内容如下
<?xml version="1.0" encoding="gbk"?>
<!-- The contents of this file will be loaded for each web application -->
<CONTEXT docBase="E:/java/code/myweb" path="/myweb" reloadable="false" crossContext="true"><!-- Default set of monitored resources --><WATCHEDRESOURCE>WEB-INF/web.xml</WATCHEDRESOURCE>
<!-- Uncomment this to disable session persistence across Tomcat restarts --><!--
<Manager pathname="" />
--><!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) --><!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<RESOURCE url="jdbc:mysql://localhost:3309/peonyoamain?autoReconnect=true" name="jdbc/ds" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" username="root" password="123456" maxActive="200" maxIdle="50" maxWait="1000" />
</CONTEXT>