0

How can I invalidate a session using EL?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Drew
  • 11
  • 2

1 Answers1

1

You could do that using JBoss EL. This EL implementation has the capability to invoke methods directly by methodname(). Put jboss-el.jar in /WEB-INF/lib and add the following to the web.xml, assuming you're using Mojarra:

<context-param>     
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>   
</context-param>

This way JSF will use this EL implementation to evaluate expressions.

Then you can do in your JSF page:

#{session.invalidate()}

Needless to say that it's not the best place/practice to do this.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • @BaluC , Then what is the best practice to invalidate a session? I have asked the same question http://stackoverflow.com/questions/5619827/how-to-invalidate-session-in-jsf-2-0 Could you pls help? – Niks Apr 11 '11 at 10:43