0

jspページから切断したいのですが、そのために私が試したのは次のとおりです。

私のJSP(accueil_mobile.jsp)で私はこれを得ました:

<form action="b" method="POST">
      <input type="submit" value="Deconnexion" />
</form>

b は、post のメソッドが次のような SERVLET を指します。

public static final String VUE = "/accueil_mobile.jsp" ;
.
.
.
protected void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
       request.getSession().invalidate();
       response.sendRedirect("accueil.xhtml");
       this.getServletContext().getRequestDispatcher(VUE).forward(request, response) ;
     }

これでセッションが無効になり、にリダイレクトされると思ってaccueil.xhtmlいましたが、ページを無期限にロードするだけです。何故ですか ?

ありがとう。

4

2 に答える 2

0

削除してみてください

this.getServletContext().getRequestDispatcher(VUE).forward(request, response) ;

リダイレクトと転送を同時に使用しようとしています。

于 2013-06-18T23:49:29.227 に答える