Jeromy Evans wrote:
Shouldn't validation just be fixed?

What you really want to say in the s:submit tag is "run this action instead" what we're currently saying is "run this method instead". Because of this, you're getting different validation than you want because changing the method doesn't change the action selection.

This isn't a validation problem, it's a problem in the ActionMapper.
In fact, it's part of the tag library that is implemented in the DefaultActionMapper code, but I believe it is moreover a result of a unfortunately chosen specification.

If we want the s:submit tag to work as currently specified, and validation to work correctly as you'd like, here's the process that must happen:

o Use normal mechanisms for selecting action mapping.
o Notice extra parameter, and modify that action mapping (which may or
  may not yield an action mapping that your specification considers
  legal/valid).
o Re-look up (backwards) what action mapping would have been chosen had
  the input been a value that would have resulted in this newly
  described action mapping.

More importantly than this being a difficult to describe/implement process even once, it is in a component of the system that is undergoing wonderful refinement/replacement with custom action mappers of various flavors (many folks have written for clients, as well as a number of plugins, etc.) each of which need to do this same strange dance to keep the current s:submit working, a complexity that we have no reason to want to add to developers shoulders. (And a place where I would bet many ActionMappers will get it wrong.)

The current s:submit implementation is also causing difficulty in the code base because it's been recognized as a possible security issue when used with URL-based authorization checking, and while a solution has been worked on, fully realizing it would require a change to the struts.xml spec to add allowable alternate method white-lists to the action mapping specification.

All this can be cleaned up if we allow ActionMappers to do their jobs without this over-specification. If we always named actions by the same name, then the right action will always be looked up and usable in it's full specification. If you allow both action selection by name and then action modification, other things that need the correct information from the action specification (like the validator) are likely to get the wrong data.

Is it really that difficult to change your submit tag from

<s:submit method="pageTwo" key="next"/>

to

<s:submit action="wizard_pageTwo" key="next"/>
? That's what you name the action everywhere else (in Wizard-wizard_pageTwo-validation.xml for example).

It would solve your validation problem and many more simultaneously. The only cost is that it makes the s:submit tag only work correctly if the client has javascript enabled.

-Dale

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

Reply via email to