Ted Husted wrote:
On Nov 6, 2007 8:10 PM, Gary Affonso <[EMAIL PROTECTED]> wrote:
For some reason folks new to s2 seem to get it backwards and want to
stuff a bunch of Action methods into a single Action class.

It's probably because the standard S2/WW validation workflow implies
that an Action class will have multiple methods that an application
will invoke in the normal course.

How does it imply that? Or do you mean "multiple methods" in the sense of prepare() and validate() in addition to execute().

I'm not suggesting those go away (I love those). But those are not "custom" action methods, those are framework action methods. So maybe I need to clarify...

When I say "one action class per action", that's what I mean. I don't mean one action class, having only one action method, per action. In other words, every unique url call into struts has a corresponding Action.

So I if I want to do the typical login stuff (which I no longer do thanks to Acegi :-), I have three urls and three actions and two views):

Urls
  http://www.myapp.com/login_form.action
  http://www.myapp.com/login_form_process.action
  http://www.myapp.com/login_thankyou.action

Actions
  LoginFormShow.action
  LoginFormProcess.action
  LoginThankyou.action

Views
  login_form.ftl
  login_form_thankyou.ftl

Meanwhile, in Struts 1 there is a
"DispatchAction" that does much the same thing. From other
discussions, I gather that "multiple actions per controller" is
considered a Good Thing on platforms like Ruby on Rails.

Curious. I've only got my niche of experience with s2, I haven't used it in every conceivable situation. But for what I do with it (fairly typical webapps) one-action-class-per-action has served me very well.

But I would love to hear reasons why I may be missing the boat, somehow. :-)

From a technical perspective, the two true pain points are "input" and
"prepare". We need a natural way to obtain an input form that can also
call a method that loads any rich controls the form may use.

I have limited experience using webwork/s2 with AJAX (I assume this is what you mean by "rich controls"). I've done a bit with integrating YUI controls with s2 Actions that deliver XML (instead of an HTML response). The single-action-class-per-action idiom work well there, though.

The
standard S2 idiom for that is Preparable and "action!input". It's an
elegant idiom, but the mechanism paves the way for other forms like
"action!create", "action!read", "action!update", and "action!delete".

Curiously, action!input is not a part of the framework I'm familiar with. Can you point me to some docs that describe it?

It might be interesting to discuss some elegant, one-method purist
alternatives that address input preparation without using method
invocation.

Again, not one *method*. That'd be crazy! But one action *class* per action with that action class only implementing "framework" methods: execute, prepare, validate (if not using xml-validation), etc.

Sorry if I wasn't clear or am still not getting something.

- Gary

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

Reply via email to