我如何从ZUL中的web-inf获取file.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)
...
答案 0 :(得分:0)
您可以尝试使用它,以便在ZK项目中检索WEB-INF文件夹的完整路径:
Sessions.getCurrent().getWebApp().getRealPath("")+"/WEB-INF/"
希望这会对你有所帮助。