2015-04-16 100 views
1

我已經添加了一個登錄到我的JSF應用程序,當我在FireFox中測試它時,它會在刷新時重新發送表單數據。
我通過this看問題和鏈接,但我沒有看到發生了什麼事情。如何阻止要求重新發送數據刷新的Firefox?

這是我的代碼。

@Override 
     public void doFilter(ServletRequest request, ServletResponse response, 
       FilterChain chain) throws IOException, ServletException { 
      try { 

       HttpServletRequest reqt = (HttpServletRequest) request; 
       HttpServletResponse resp = (HttpServletResponse) response; 
       HttpSession ses = reqt.getSession(false); 

       String reqURI = reqt.getRequestURI(); 
       if (reqURI.indexOf("/login.xhtml") >= 0 
         || (ses != null && ses.getAttribute("username") != null) 
         || reqURI.indexOf("/public/") >= 0 
         || reqURI.contains("javax.faces.resource")) 
        chain.doFilter(request, response); 
       else{ 
        resp.sendRedirect(reqt.getContextPath() + "/faces/login.xhtml"); 
       } 
      } catch (Exception e) { 
       System.out.println(e.getMessage()); 
      } 
} 
+0

@BalusC http://balusc.blogspot.com/2007/03/post-redirect-get-pattern.html嗯,我似乎一切你想了解有BalusC;)所以這就是答案! – helloWorld

回答

0

登錄成功後使

+0

balusc.blogspot.com/2007/03/post-redirect-get-pattern.html – helloWorld