This is a problem with using the LookupDispatchAction. Since the validation
is mapped to the formBean name or the url it will always validate as long as
you call the url. You could set validate to false and manually validate in
the LookupDispatchAction or not depending on what method you call.

I submitted a ValidatorLookupDispatchAction that allows you to map to a
validation key that is compatible with the LookupDispatchAction. However
validation happens in the Action class and not in the form.

see this for details:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg12962.html
http://www.mail-archive.com/[EMAIL PROTECTED]/msg12966.html

Brandon Goodin
Phase Web and Multimedia
PO Box 85
Whitefish MT 59937
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws


-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED]
Sent: Monday, February 24, 2003 1:32 PM
To: [EMAIL PROTECTED]
Subject: Strange Validator Issue


I'm using Struts 1.1 RC1 and I can't seem to figure this one out...

Basically, when I click on a cancel button, the client-side validation
is stopped, but not the server-side.

Here's my cancel button:

<html:cancel styleClass="button" property="action">
        <bean:message key="button.cancel"/>
</html:cancel>

--> onclick="bCancel=true;" is added automagically by Struts when
rendering.

My form's action is "saveUser" which does specify validation="true"

    <action
      path="/saveUser"
      type="org.appfuse.webapp.action.UserAction"
      name="userForm"
      scope="session"
      input="editProfile"
      parameter="action"
      unknown="false"
      validate="true"
    >

Since UserAction.java is a subclass of LookupDispatchAction, I should be
able to map button.cancel to a "cancel" method, which I have done, but I
never get to it.  The Validator tries to validate the form anyway:

DEBUG [Thread-5] RequestProcessor.processActionForm(367) |  Storing
ActionForm bean instance in scope 'session' under at
tribute key 'userForm'
DEBUG [Thread-5] RequestProcessor.processPopulate(808) |  Populating
bean properties from this request
DEBUG [Thread-5] RequestProcessor.processValidate(935) |  Validating
input form properties
DEBUG [Thread-5] PropertyMessageResources.getMessage(177) |
getMessage(en_US,userForm.password)
DEBUG [Thread-5] PropertyMessageResources.loadLocale(266) |
loadLocale(en_US)
DEBUG [Thread-5] PropertyMessageResources.getMessage(177) |
getMessage(en_US,userForm.email)
DEBUG [Thread-5] PropertyMessageResources.loadLocale(266) |
loadLocale(en_US)
DEBUG [Thread-5] RequestProcessor.processValidate(967) |  Validation
failed, returning to 'editProfile'
DEBUG [Thread-5] TilesRequestProcessor.processForwardConfig(298) |
processForwardConfig(/userProfile.do, false)

Thanks,

Matt

P.S.  I've written about my upgrade from Struts 1.1b3 to Struts 1.1rc1
at http://tinyurl.com/6cp9




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



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

Reply via email to