I was one of the proponents of POJOs as Actions a week or so ago, but upon further reflection I have to ask the question... what does this really get anyone? I'm not really sure I see the benefit to it any more. In fact, it would seem that keeping Actions as Actions makes it a little safer in that you can be sure the class being called is actually an Action.

Also, it seems odd to be talking about Actions *or* Commands (or POJOs)... Making them Commands makes some sense to me, but it feels wrong to allow both. I would personally say one or the other, with a lean towards Commands.

Now, that of course raises compatibility issues, so talking about something like an ActionCommandWrapper that presents an Action like a Command makes sense to me.

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

Joe Germuska wrote:
I wrote:

Yes... I'm sorry that that discussion has stalled. Although I don't even know if that's an incremental step towards a POJO action -- it's practically all you need, plus a little more smarts in the CreateAction command. I'll go post a ping.


OK, so I actually started looking at using POJOs for Actions, and it's a bit trickier than I'd thought, but I may want to use it on a current project, so if people want to talk about it, there's a chance I'll get it into Struts 1.3 sooner than later...

I like the general idea of saying that the "type" property can be an Action, a Command, or a pojo. Perhaps there's no point in using Command when you can use a pojo too?

My thought is that CreateAction would just check the type instance and if it wasn't an instance of Action, it would wrap it in a new class, ActionWrapper, which would take an instance and a method and then do the invocation in its execute method.

Postulating something like ActionContextFactory.getCurrentInstance(), the ActionWrapper would look something like this:

public class ActionWrapper extends Action {
public ActionWrapper(Object instance, String method) {
this.instance = instance;
this.method = method;
}
public ActionForward execute(m,f,r,r) {
Object pojo = getInstance();
// perform reflection and invocation
return (ActionForward) ActionContextFactory.getCurrentInstance().getForwardConfig();
}
}


Does that seem like a workable approach?

Along the way I was also entertaining thoughts of getting ActionCommand in here, but then I kept thinking "why again didn't we change Action to have an 'execute(ActionContext)' method"? But I guess if there's a way to execute POJOs then I have a ready way to get the current ActionContext, which is the real item of interest -- especially if we are using a custom implementation of ActionContext with properties that reflect our application's request/session-scoped properties.

Joe





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



Reply via email to