struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <>
Subject S2 how to determine if a session exists from an Interceptor
Date Thu, 06 Feb 2014 14:14:44 GMT
I have an Interceptor that wants to put something in the session after the
action has executed.

But if the session doesn't already exist I get an exception:

java.lang.IllegalStateException: Cannot create a session after the response
has been committed
How can I determine if the session already exists from within an

 public String doIntercept(ActionInvocation invocation) throws Exception
   String result = invocation.invoke();
   Map<String, Object> session =
   session.put(key, value); // throws exception if session doesn't exist
   return result;


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message