【发布时间】:2026-01-11 21:35:01
【问题描述】:
我正在尝试在 JSP 中使用我的属性文件,但它无法正常工作并引发错误
Error: myproperties.properties (The system cannot find the file specified)
我在这里尝试访问我的属性文件:
<%
try
{
FileInputStream fis = new FileInputStream("myproperties.properties");
Properties p = new Properties();
p.load(fis);
String LogFileName = p.getProperty("NameOfLogFile");
out.println(LogFileName);
}
catch (Exception e)
{// Catch exception if any
out.println(e.getMessage());
}
我已经尝试了很多方法来访问属性文件。我该如何解决这个问题?
【问题讨论】:
-
你的应用结构是什么? jsp和properties文件在哪里??
-
文件在你项目的
/src文件夹下吗?
标签: java jsp properties