【发布时间】:2013-03-11 09:55:03
【问题描述】:
我试图在我的拦截器中使用@aroundInvoke,检查一些validationX以继续执行该方法,否则将用户重定向到特定的JSF页面。
@AroundInvoke
public Object myInterceptor(InvocationContext invocation) throws Exception {
if(validationX){//it passes the validation so proceed
return invocation.proceed();
}else{//it doesnt passes the validation so go to
//DO SOMETHING TO REDIRECT TO SPECIFIC JSF
}
}
我试过了:
- 使用“JSF?faces-redirect=true”返回字符串 ----- 我得到转换错误(字符串到方法应返回的任何内容)。
- FacesContext.getCurrentInstance().getExternalContext().dispatch("/JSF.jsf"); ----- 我使用 getCurrentInstance 方法得到 nullPointerException。
- FacesContext.getCurrentInstance().getExternalContext().redirect("/JSF.jsf"); --------同样的NullPointerException。
- 使用 HttpServletRequest 和 HttpServletResponse 生成响应,但出现 NullPointer 异常。
提前致谢!
【问题讨论】:
标签: jakarta-ee jsf-2 ejb interceptor