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
Interceptor?

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

Thanks
Greg

Reply via email to