title: Redirecting to home page if user is already logged in
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8239925/how-to-redirect-to-another-page-when-already-authenticated-user-accesses-login-p">How to redirect to another page when already authenticated user accesses login page</a>  </p>
  </blockquote>
  
  
  
  <p>If a logged in user clicks on <code>login.jsp</code> page then he should be automatically redirected to his <code>home.jsp</code>. Before authentication user goes to <code>login.jsp</code> and after successfully authenticated by a servlet (doPost) he is redirected to <code>home.jsp</code>, but when again the same user clicks on login page then he should be automatically redirected to <code>home.jsp</code> instead of logging again. How can I do it in JSP/Servlet? I am setting session from that servlet after successfully authenticated.</p>
  
  <p>Before login, user clicks on <code>login.jsp</code> and goes to <code>doPost()</code> method of servlet and goes to <code>home.jsp</code>. After logged in succesfully, if user clicks again on <code>login.jsp</code> then instead of going to <code>login.jsp</code>, control should go directly to <code>home.jsp</code>. How can I do it?</p>
  
  <p>If user is signed out then only after clicking <code>login.jsp</code> control will go to <code>login.jsp</code> and then <code>doPost()</code> of servlet and finally <code>home.jsp</code> will come.</p>