On Wednesday, July 2, 2003, at 03:35 PM, Jason Carreira wrote:
I find it very useful to have multiple entry points to one Action, so you don't have to have a proliferation of Action classes and they can share common properties and validations... If you don't have this, you end up with people either creating class hierarchies to share this state or passing special parameters to allow a larger grained action to dispatch within itself, like the way ActionSupport did in WW1.x, or they do BOTH. The ability to map aliases to entry point methods is VERY useful for some people, myself included.

You extend from ActionSupport generally? Or Action?


Just for fun I coded this up:

public class DispatchAction implements Action {
    private String method;

    final public void setMethod(String method) {
        this.method = method;
    }

    final public String execute() throws Exception {
        System.out.println("invoke: " + method);

        return SUCCESS;
    }
}

Of course just substitute the right reflection voodoo in execute() to call whatever method you want. I'd make this abstract, of course, and that is why I made the two methods final. In xwork.xml I set <param name="method">someMethod</param> and have the static interceptor configured. With the dynamic param interceptor also in the stack I was able to switch the method from ?method=blah too.

What is wrong with that approach with how you want things to work? Just because of subclassing?

Erik "still +1 on Action, with no other entry points" :)



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to