jsp怎么获取spring配置文件properties中的信息
1个回答
展开全部
<%@ page import="java.sql.* " %>
<%@ page import=",java.io.*" %>
<%@ page import="java.util.*" %>
<%
Properties pro = new Properties();
String realpath = request.getRealPath("/");
try{
FileInputStream in = new FileInputStream(realpath+"site.properties");
pro.load(in);
}
catch(FileNotFoundException e){
out.println(e);
}
catch(IOException e){out.println(e);}
String site = pro.getProperty("sitename");
out.println(site);
%>
jsp 读取Properties文件!
<%@ page import=",java.io.*" %>
<%@ page import="java.util.*" %>
<%
Properties pro = new Properties();
String realpath = request.getRealPath("/");
try{
FileInputStream in = new FileInputStream(realpath+"site.properties");
pro.load(in);
}
catch(FileNotFoundException e){
out.println(e);
}
catch(IOException e){out.println(e);}
String site = pro.getProperty("sitename");
out.println(site);
%>
jsp 读取Properties文件!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询