What we may see is a CommandAction in the Actions directory that, as Craig mentioned, knows how to invoke a Command/Chain from a Catalog.

An official CommandAction! Very cool. I have a custom one that checks the action form for a property called command. If there is no form associated with the action, (or the form doesn't have a "command" property), it examines the request attributes and then request parameters for the presence of a "command" attribute. If it comes up empty, it executes the default command associated with that action. (see below)


Then, when we are comfortable with how that standard Action works, we might consider adding a "command" property to ActionMappings, to do the same thing.

FWIW, I extended ActionMapping for my app in a way that sounds extremely similar to this. (It was a snap to integrate into the Struts framework btw, because of the extremely forward-looking rule set used to parse struts-config.xml) My "CommandActionMapping" has 3 extra properties, "defaultCommand", "catalogKey", and "commandKey"


catalogKey - defaults to "catalog" and is the name of the servlet context attribute where the Catalog of commands is kept

commandKey - defaults to "cmd" and is the name of the form property or request attribute/parameter where the current command to execute can be found.

defaultCommand - the name of the command to execute when no explicit command has been requested

The behavior I needed was for the action to be able to invoke different commands on request, but have a default command to fall back on.

IMHO, the right thing is to program in Commands (or the equivalent) rather than Actions.

Couldn't agree more :-) That CommandAction + the Chain API is proving to be an extremely powerful combination for us right now.



-Ted.


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



Reply via email to