Wendy Smoak wrote:

Jeff wrote


Just store the mappings between submit buttons and methods in the ApplicationResources.properties file along with everything else, and then extend LDA in such a way that it looks in there to figure out which method to invoke.


LDA already does that, you don't need to extend it. Just add the
'parameter' attribute to the <action> tag, make your action extend
LookupDispatchAction, and implement the getKeyMethodMap method.


What I thought you meant was add lines to AppResources.properties that supplied the mappings LDA needs in getKeyMethodMap():

#Normal button stuff
button.delete=Delete
button.ok=Ok

#New mappings used only by LDA
myAction.handleUpdate=button.ok
myAction.handleDelete=button.delete

Then implement getKeyMethodMap() something like this:
protected Map getKeyMethodMap() {
 Properties props = <logic to load ApplicationResources.properties>
 Enumeration keys = props.keys();
 Map map = new HashMap();
 while(keys.hasMoreElements()) {
   String key = (String)keys.nextElement();
   if (key.startsWith("myAction.")) {
     String method = key.substring(key.indexOf("myAction.") + 1);
     String button = props.get(key);
     map.put(button,method);
   }
 }
 return map;
}

That way if the need arises to handle a cancel button, all that is required to route the request to the proper method is two lines in the properties file:

button.cancel=Cancel
myAction.handleCancel=button.cancel

If that's not what you meant, you get credit for inspiring a new thought, but I'm taking credit for the thought itself :-)


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



Reply via email to