如何在 struyts 1.3.8 的 struts-config.xml 中配置数据源?
我的示例数据源:
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="dbSource">
<set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
<set-property property="url" value="jdbc:mysql://localhost:3306/bookstore" />
<set-property property="username" value="root" />
<set-property property="password" value="sf~007tech" />
</data-source>
</data-sources>
代码:
dataSource = (DataSource)servlet.getServletContext().getAttribute("dbSource");