从jsf bean转发请求时出现奇怪问题。请求正在转发,没有任何问题。转发网址页面正确显示在浏览器中,但在页面底部,它还包含来自jsf页面的转发结果。
我尝试在执行转发之前执行response.reset()。但它仍无效。
我使用Balus的方便LifeCycleListner来查看正在发生的事情。以下是我看到的内容
我想当它回到Render_response短语时,它会将jsf页面附加到转发页面的末尾。
我的转发代码如下所示:
public void forwardHttpRequestTo(String url) {
try {
HttpServletRequest request = getHttpServletRequest();
HttpServletResponse response = getHttpServletRespose();
try {response.reset();} catch (Exception ex) {ex.printStackTrace();};
RequestDispatcher dispatcher = request.getRequestDispatcher(url);
dispatcher.forward(request, response);
}
catch (Exception ex) {
throw (RuntimeException) ex;
}
}
public HttpServletRequest getHttpServletRequest() {
return (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
}
public HttpServletResponse getHttpServletRespose() {
return (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
}