我如何从 ZUL 中的 web-inf 获取文件的真实路径.xml,我试试这个:
org.zkoss.zrss.RssFeed feed;
org.zkoss.zrss.RssBinder binder = new org.zkoss.zrss.RssBinder();
try {
feed = binder.lookUpFeed(new File("/WEB-INF/lesscoutsBeRss.xml").toURI().toURL().toString());
} catch (Exception e) {
e.getStackTrace();
}
但是我有问题,我认为问题是因为不好的好恢复路径
Failed to load /MainPage/rss_lesscouts.zul
Cause: Null Pointer in Method Invocation
java.lang.NullPointerException: Null Pointer in Method Invocation
at bsh.Name.invokeMethod(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimarySuffix.doSuffix(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHVariableDeclarator.eval(Unknown Source)
at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
...
您可以尝试使用它来检索 ZK 项目中 WEB-INF 文件夹的完整路径:
Sessions.getCurrent().getWebApp().getRealPath("")+"/WEB-INF/"
希望这对你有帮助。