[英]Dynamically add .xhtml file in webapp folder
我想在项目的webapp文件夹中动态添加新的.xhtml
文件。 只有当我给出完整路径时,它才起作用,
FileWriter fw = new FileWriter("D:/projects/UIBindingExample/src/main/webapp/pagefour.xhtml");
fw.write("<html>...some code....</html>");
fw.close();
而不是我想使用文件的相对路径来使其工作,
src/main/webapp/pagefour.xhtml
我尝试了这个。但是它不起作用。!!! 我该怎么办? 感谢在广告中。
src/main/webapp/pagefour.xhtml
是您Webapp上下文的相对路径,因此可能如果运行此代码,最终将文件内容保存到D:/projects/UIBindingExample/target/your-artifact-name/WEB-INF/main/webapp/pagefour.xhtml
其中, your-artifact-name
是生成的WAR文件的名称。
希望能有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.