如何在jsp中读取配置文件的内容

2025-02-24 07:21:31
推荐回答(2个)
回答1:

<%
Properties pro = new Properties();
pro.load(new FileInputStream((c:/jdbc.properties")));//配置文件路径
db_userName = pro.getProperty("db_userName");
db_passWord = pro.getProperty("db_passWord");
%>
之后自己用eclipse或者IDEA加try catch

回答2:

方式1 后端往前端传el表达式获取
方式2
<%
InputStream 去处理
%>