閱讀Java文件我的應用程序的目錄結構如下: -無法從JSF
My App
++++++ src
++++++++com
++++++++++readProp.java
++++++++resource
++++++++++message.properties
我試圖讀取該文件,如下所示: -
public Static final string FilePath="resource.message.properties"
下面的代碼讀取文件。我嘗試使用以下兩種方法,但都沒用......
File accountPropertiesFile = new File(FacesContext.getCurrentInstance()
.getExternalContext().getRequestContextPath()
+ FilePath);
properties.load(externalContext.getResourceAsStream(FilePath));
但通過Bean類讀書時,沒有任何一代產量sucess。請幫助...