1. Modify the server.xml (path: $TOMCAT_HOME$/conf)Add :
<resource
auth="Container"
name="mysql/test"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
password=""
maxIdle="30"
maxWait="10000"
username="root"
url="jdbc:mysql://localhost:3306/strutsarticle"
maxActive="20">
between <globalnamingresources /> </globalnamingresources />.
2.Modify Context.xml (path:$TOMCAT_HOME$/conf)
<resourcelink type="javax.sql.DataSourcer" global="mysql/test" name="mysql/test" />
comment: defined a global parameter for the JNDI name.
3.Create MyWebProject.xml , Content like flow:




















after create the MyWebProject , save it into (path:$TOMCAT_HOME$/conf/Catalina/localhost)
4.create a jsp page(named index.jsp) for testing (create a folder into $TOMCAT_HOME$/webapps named MyWebProject ) , jsp page's content like flow:






































5. create a config file (web.xml) for u application (path :$TOMCAT_HOME$/webapps/MyWebProject/WEB-INF), like this:



























6. run the Tomcat server , and enter the http://127.0.0.1:8080/MyWebProject/,is">URL:http://127.0.0.1:8080/MyWebProject/ , it's ok .