On 12.Feb.2002 -- 02:34 PM, Torsten Curdt wrote:
> While working with actions something bugs me more and more... For each
> very simple action you need to have a new class. Although it might be just
> a few lines for each, it becomes really ugly when you share code with
> other actions or need to call an action from an action. Plus having
> thousand of action class for a single webapp. Sure this all possible and
> one can say: then use helper classes that hold all the shared code. But
> well - possible does not mean confortable.
>
> IIRC with Turbine e.g. it is way more confortable. They use
> "methods as actions":
>
> class SomeActions {
>
> public void doMyAction(..) {
> ...
>
> (I'm not quite sure about the arguments and stuff though)
> This helps to have all related code at a glance.
> Although I'm not yet sure what syntax should be prefered
>
> 1. <map:action type="SomeActions.doMyAction">
> <!-- directly use the method -->
>
> 2. <map:action type="SomeActions.MyAction">
> <!-- have a fix prefix like "do" -->
>
> 3. <map:action type="SomeActions" method="doMyAction">
>
> 4. <map:action type="SomeActions" method="MyAction">
>
5. <map:act type="SomeAction>
<map:parameter name="do" value="MyAction"/>
</map:action>
Which is currently possible. Afterall, no one prevents you from
dispatching different methods from your act method. It might be nice
to have a sample implementation, though.
You could even have an default value for @do and define several
actions...
This has two short comings:
a) syntax is too verbose
b) when creating multiple "aliases" for an action with different
default values for @do it would result in seperate instance of that
class while Torsten's proposal would share the same
instance. (Hence the term "alias" is not correct!)
IMHO it would be cool to have a simple syntax for handing *exactly
one* parameter to any component without the need to nest a
<map:parameter/> element.
But then, the sitemap is probably going to be edited with a tool
anyway. Plus the syntax as is is clear and changes would need to
achieve the same clarity.
Just my 2�
Chris.
--
C h r i s t i a n H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]