title: How to invalidate session in JSF 2.0?
body: <p>What is the best possible way to invalidate session within a JSF 2.0 application? I know JSF itself does not handle session. So far I could find </p>
  
  <pre><code>private void reset() {
      HttpSession session = (HttpSession) FacesContext.getCurrentInstance()
              .getExternalContext().getSession(false);
      session.invalidate();
  }
  </code></pre>
  
  <ol>
  <li>Is this method correct? Is there a way without touching the
  ServletAPI?</li>
  <li>Consider a scenario wherein a <code>@SessionScoped</code> UserBean handles the
  login-logout of a user. I have this method in the same bean. Now
  when I call the <code>reset()</code> method after I'm done with necessary DB
  updates, what will happen to my current session scoped bean? since
  even the bean itself is stored in <code>HttpSession</code>?</li>
  </ol>