【发布时间】:2013-04-05 00:41:40
【问题描述】:
要使用 Glassfishv3 网络服务器读取 JSF2.0 中的 properties 文件,该文件位于我的网络应用程序的 root directory,我使用以下代码-
ServletContext ctx = (ServletContext) FacesContext
.getCurrentInstance().getExternalContext().getContext();
String deploymentDirectoryPath = ctx.getRealPath("/");
Properties prop = new Properties();
prop.load(new FileInputStream(deploymentDirectoryPath
+ File.separator + "portal-config.properties"));
以下是门户网站的截图-
在运行门户时,我收到 FileNotFound 错误,因为 glassfish 域中不存在该文件。
有没有什么方法可以在开发阶段和战争文件中读取属性文件?
【问题讨论】:
标签: jsf-2 primefaces glassfish-3