私はJSF2フレームワークでGlassfish 4サーバーを使用しています。 response.sendRedirectメソッドを呼び出すときsendRedirect後のIllegalStateException
私の問題は
、私はIllegalStateExceptionが抱えています。
なぜこの例外が発生したのかという単なる手掛かりはありません。
すべてのXHTMLページのコンテキスト
、私は、ユーザーがまだログインしているかどうかを確認するために呼び出され、このメソッドを持っている。
<body id="body" onload="#{utilisateurBean.isUserLoggedIn()}">
方法
public void isUserLoggedIn() throws IOException {
if(this.user == null){
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.sendRedirect("Project/accueil/index.xhtml");
}
}
例外
Infos: Exception when handling error trying to reset the response.
java.lang.IllegalStateException
それとも
Avertissement: Servlet.service() for servlet session.AppExceptionHandler threw exception
java.lang.IllegalStateException: Cannot forward after response has been committed
応答がコミットされている理由私は知りません。あなたの助けのための
感謝:)
ありがとう、私は私の問題を修正しました。私はどうしてもスタイルタグ内のCSSを取り除いて(頭のタグで)トリックをやっていません。 – Knriano