我需要在@WebListener
.
我以为我可以使用这样的代码片段
final FacesContext currentInstance = FacesContext.getCurrentInstance();
final String actionURL = currentInstance.getApplication().getViewHandler()
.getActionURL(currentInstance, viewId);
因为.getCurrentInstance()
断言的 javadoc 可以“在应用程序初始化或关闭期间调用 [...]”,但它不起作用,因为它返回 null。
我错过了什么吗?给定 viewId 的任何其他方式来构建 url?
谢谢