如何从Jdeveloper ADF中的相对路径读取文件?

时间:2016-12-26 23:51:20

标签: java oracle-adf jdeveloper backing-beans

我想从Jdeveloper Adf项目中的相对路径读取文件,我的文件位于“\ ProjectName \ ViewController \ public_html \ files”这样的路径中,我的文件是图像,所以我该怎么办? ?,我希望我的代码可以在任何服务器上运行。

1 个答案:

答案 0 :(得分:0)

我希望我的答案对其他人有用,

我已使用以下代码

读取该文件
        ServletContext servletCtx = ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();


        InputStream inputStream = servletCtx.getResourceAsStream("/images/image.png");

我的项目和resurces的路径是这样的

“\项目名\的ViewController \的public_html \图像”

问候。