当前位置: 编程技术>java/j2ee
jsp 从web.xml读取连接数据库的参数
来源: 互联网 发布时间:2014-10-17
本文导语: 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需要读取的内容: 代码如...
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需要读取的内容:
driver
com.mysql.jdbc.Driver
url
jdbc:mysql://localhost:3306/j2ee
user
root
pass
32l47
代码如下:
String driver = application. getIni tParameter ("driver") ;
String url = application.getInitParameter("url");
String user = application.getInitParameter("user");
String pass = application.getInitParameter("pass");
web.xml需要读取的内容:
代码如下:
driver
com.mysql.jdbc.Driver
url
jdbc:mysql://localhost:3306/j2ee
user
root
pass
32l47