JSF%20Interview%20Questions%20and%20Answers
Question: How to terminate the session?Answer: In order to terminate the session you can use session invalidate method.This is an example how to terminate the session from the action method of a backing bean: public String logout() { FacesContext fc = FacesContext.getCurrentInstance(); HttpSession session = (HttpSession) fc.getExternalContext().getSession(false); session.invalidate(); return "login_page"; } The following code snippet allows to terminate the session from the jsp page: <% session.invalidate(); %> |
Is it helpful?
Yes
No
Most helpful rated by users:
- What is JSF?
- What is required for JSF to get started?
- What is JSF architecture?
- How the components of JSF are rendered? An Example
- How JSF different from conventional JSP / Servlet Model?