You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by fz...@omnytex.com on 2005/01/24 16:05:45 UTC

SimpleAction and/or scriptable Actions

Good morning all... I had a thought bouncing around in my head on the drive in (a rather extended drive due to the weather from this weekend!), and I wanted to bring it up here and see if (a) it's been done already and/or (b) anyone thinks it's an interesting idea worth pursuing...

It occurred to me that many Actions in Struts do little more than transfer values from an ActionForm to a Data Transfer Object, and then send that DTO along to some method of some business delegate, and finally transfer the DTO values back to the ActionForm and forward the request.  At least, that would seem to be the ideal we're all striving for.

My thought was this... what if that process could be boiled down to some configuration options in struts-config, and a new type of Action, perhaps called LazyAction, was created that used that information?  In that way, this simple case wouldn't require anyone to write Actions, just configure it properly and your done.  I could see simply specifying the ActionForm class, the DTO class, the business delegate class and method, and the forward.  I'm not sure how best to handle variable forwards, perhaps a simple expression to evaluate (i.e., if the method's return type is A, use forward A, if B, then B, etc.)

The other idea, which is an extension of that, is what if we had a ScriptableAction?  This would be an Action that you could write a chunk of script for (maybe Javascript for example) in struts-config, and the execution of that script would in effect be an Action?  Again, no need to create an Action for everything, just write some script... This might be useful in those situations that are a little more complex than that simple example above, but that aren't so complex that writing an Action is completely warranted.

I submitted a patch for DataVision that extends the formula scripting support using BSF, and it was a very simple process, and it provides Javascript, Python and Ruby support (among others, but those are all I enabled with that patch)... I'm sure using that here wouldn't be too difficult either.

Any thoughts on this?  I couldn't immediately find anything similar, but that doesn't mean it's not an old idea anyway.  If it is original, does it sound worth pursuing?  Thanks!

Re: SimpleAction and/or scriptable Actions

Posted by Pavel Kolesnikov <pa...@gmail.com>.
On Mon, 24 Jan 2005 07:05:45 -0800 (PST), fzlists@omnytex.com
<fz...@omnytex.com> wrote:

> The other idea, which is an extension of that, is what if we had a ScriptableAction?  

Check out http://struts.apache.org/bsf/index.html , I guess it comes
with something
like your "ScriptableAction" funcionality (but I haven't tested it yet).

Pavel

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org