Hi Jeromy, thanks for the respose. The response is already committed in the action class (before the Result is executed). In the execute() method, the result of 'response.isCommitted()' is true. So I think the response is committed even before getting to the Result.
According to J2EE documentation, when using RequestDispatcher.include(rquest, response), you can't set headers in the response, which means you can't set cookies. That's the problem I'm having - I can't set a cookie in the action class called via s:action. So perhaps that's what s:action does, it does an include. David Jeromy Evans <[EMAIL PROTECTED] eskyminds.com.au> To Struts Users Mailing List 06/13/2008 10:04 <user@struts.apache.org> PM cc Subject Please respond to Re: Response already committed when "Struts Users using ActionTag Mailing List" <[EMAIL PROTECTED] he.org> [EMAIL PROTECTED] wrote: > I have a JSP that uses an ActionTag <s:action> to call a Struts 2 action > class directly from the JSP. But in the action class, the HTTP response > has already been committed. This makes it impossible for me to set cookies > from my action class. > > I tested this by calling HttpServletResponse.isCommitted() is my execute() > method of my action class, and it returns true. > > Is this a bug? Why is the response committed if the JSP hasn't finished > rendering? > Struts2 ActionInvocations are not designed to be nested, but the s:action tag attempts to do this. It works most of the time, but not all Results can be executed within another page, and not pages can handle changes to the ActionContext by the nest invocation. The Action tag is quite dodgy for this reason but there is currently no better alternative in S2. The problem is your case is with the Result that was executed. I presume it has executed a ServletRedirectResult which assumes it can commit the response (and does). TilesResult also has the same problem. Try a different Result type. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- This message, together with any attachments, is intended only for the use of the individual or entity to which it is addressed. It may contain information that is confidential and prohibited from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination or copying of this message or any attachment is strictly prohibited. If you have received this message in error, please notify the original sender immediately by telephone or by return e-mail and delete this message, along with any attachments, from your computer. Thank you. --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]