I have been trying to figure out how to handle
a cancel button using LookupDispatchAction.
Specifically, I want to not do form validation
if the cancel button is pressed. I found out from
discussion on this list that the cancel button
ends up with a different name attribute than
other submit buttons on the form. This causes
a problem with LookupDispatchAction since
the parameter is not sent in the request. As an
experiment, I copied LookupDispatchAction
into my source tree, changed the name to
LookupOrCancelDispatchAction and made
a simple change to it. Before any other processing
takes place in the execute method, the following
code is processed:

if (request.getParameter("org.apache.struts.taglib.html.CANCEL") != null)
return dispatchMethod(mapping, form, request, response, "cancel");


In my action that extends LookupOrCancelDispatchAction,
I do exactly what I did with LookupDispatchAction except
I don't bother defining a cancel method mapping and I do write a
cancel method. This works just great. I just think that this
behavior should be supported in the framework. It makes me
feel uneasy to copy a framework class and modify it in order
to accomplish what I think is probably frequently need
behavior. Any thoughts?

Dean Hoover


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to