Chris, You pretty much have it - the point at which the value submtted by the tag is converted to Globals.CANCEL_KEY is in the RequestProcessor's processPopulate() method.
Having said that, Struts 1.3.5 uses the new ComposableRequestProcessor which replaces all that RequestProcessor functionality with a set of Commands and its taken care of in the Command AbstractPopulateActionForm in the handleCancel() method. Also I think theres an open Jira ticket for this - but I can't seem to locate it ATM. Niall On 3/5/07, Christopher Schultz <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 All, [Reposted, as I didn't get a response for 2 months :(] I have two actions in my code that I want to be able to cancel out-of, but neither of them is exciting enough to warrant a form bean and a trip through the validator. I have found that Action.isCancelled does not work when this is the case. A simple hackaround is to do this in my action code: if(super.isCancelled(request) || null != request.getParameter(org.apache.struts.taglib.html.Constants.CANCEL_PROPERTY)) { // handle cancellation } This week, I'm upgrading to struts-1.3.5, which has the taglib JAR separate from the core JAR, which means that I need to drag the taglib JAR along with my upgrade, and I'd prefer not to do so (ignore the fact that I need that JAR file for velocity-tools to work ;) . I figured it's time for me to get to the bottom of this problem, and I'm finding myself getting quite confused reading through the code. First, anyone who looks will note that the name of the "cancel" button used by the struts form tag library (and the FormTool from velocity-tools's struts tools) get the name "org.apache.struts.taglib.html.CANCEL", which is the string value of org.apache.struts.taglib.html.Constants.CANCEL_PROPERTY. So far, so good. Now, to find out how Aciton.isCancelled works. It's pretty simple: it checks for a request attribute: protected boolean isCancelled(HttpServletRequest request) { return (request.getAttribute(Globals.CANCEL_KEY) != null); } The string value for Globals.CANCEL_KEY is "org.apache.struts.action.CANCEL", which doesn't match up with that used by the tag libaray. No big deal... it probably gets detected somewhere in the request processor, right? Well, I checked. The RequestProcessor only mentions "cancel" in the processPopulate method, which delegates some processing to RequestUtils.populate and then checks the request parameters for Globals.CANCEL_KEY (or Globals.CANCEL_KEY_X for image submissions). No luck there, so let's look at RequestUtils.populate. RequestUtils.populate only sets properties on the ActionForm, and doesn't mess with the request. I can't seem to find the place where (under regular circumstances) the request parameter "...taglib.html.CANCEL" gets converted into the request attribute Globals.CANCEL. Can someone help me understand how this works? I'd like to do the "right" thing, here, and I need to understand how struts handles this stuff during form submission so I can get it working when there is no form. Any enlightenment would be appreciated. - -chris
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]