我想用我的屬性文件在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'文件夾下? –