jsp或servlet页面代码:
复制代码 代码如下:
String driver = application. getIni tParameter ("driver") ;
String url = application.getInitParameter("url");
String user = application.getInitParameter("user");
String pass = application.getInitParameter("pass");
web.xml需要读取的内容:
复制代码 代码如下:
context-param>
param-name>driver/param-name>
param-value>com.mysql.jdbc.Driver/param-value>
/context-param>
context-param>
param-name>url/param-name>
param-value>jdbc:mysql://localhost:3306/j2ee/param-value>
/context-param>
context-param>
param-name>user/param-name>
param-value>root/param-value>
/context-param>
context-param>
param-name>pass/param-name>
param-value>32l47/param-value>
/context-param>
您可能感兴趣的文章:- jsp读取数据库实现分页技术简析
- 利用asp或jsp,flash怎样把数据库中的一张表中的所有记录读取并显示出来
- 如何用Jsp读取Mysql数据库
- 读取数据库的数据并整合成3D饼图在jsp中显示详解