You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Schumeyer <rs...@ieee.org> on 2007/05/10 22:01:11 UTC
Are S2 actions POJOs?
It's quite possible I'm confused, but I thought that actions in S2 were
now POJOs. In Webwork in Action, for example, we see:
public class HelloWorld implements Action
but in the blank application we see
public class ExampleSupport extends ActionSupport
Is this an example where Webwork in Action is out-of-date, or can you
still do something like that with S2? If so, is there a reason why I
*would not* want to use POJOs with an Action interface?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Are S2 actions POJOs?
Posted by Don Brown <do...@gmail.com>.
You were correct - Actions in S2 can be POJO's. They don't need to
implement or extend anything, and in fact, don't even need any
annotations. Now, we still do have an Action interface with a single
execute method that you can implement if you'd like, and we also have
several support classes you can extend - ActionSupport and
DefaultActionSupport - with the latter being the preferred superclass.
How Struts 2 handles things like localisation, validation, error and
normal messages, etc., is through decorating your Action with certain
interfaces like Validatable and TextProvider. These support classes
implement many of these extra interfaces, saving you time and code,
but as I mentioned, they are completely optional.
Don
On 5/11/07, Rick Schumeyer <rs...@ieee.org> wrote:
> It's quite possible I'm confused, but I thought that actions in S2 were
> now POJOs. In Webwork in Action, for example, we see:
>
> public class HelloWorld implements Action
>
> but in the blank application we see
>
> public class ExampleSupport extends ActionSupport
>
> Is this an example where Webwork in Action is out-of-date, or can you
> still do something like that with S2? If so, is there a reason why I
> *would not* want to use POJOs with an Action interface?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Are S2 actions POJOs?
Posted by אלחנן מעין <em...@msn.com>.
although i haven't done much of web frameworks development i recommend
against turning you actions, into the actuall pojos, develop as much pojos
as you can, with only pure java elements (or commons utils for allready been
there done that fame of mine), test them as though they are alone in the
planet, and use the actions around them. the reason for this, is that in my
opinion, is that sooner or later you may need to have frameworks'
interfaces,utils, or abstract classes to make it easy for you,maybe becouse
of a bug in the framework itself (like databinding in timepicker), but when
you do that, when you let a single import of opensymphony's creep into you
pure java code, then you allready coupled your core model into A framework.
allow your actions to be the convergence of "dirty" code, the meeting place
between business and web actiions, use as much of the framworks abilties
ONLY there (anntoatins, abstract classes etc...) and let everything else be
taken care of by pure java.
>From: "Frank W. Zammetti" <fz...@omnytex.com>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>CC: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: Re: Are S2 actions POJOs?
>Date: Thu, 10 May 2007 16:07:56 -0400 (EDT)
>
>Your Actions *can* be POJOs... they also *can* implement certain
>interfaces, and they *can* extend certain base classes... implementing the
>interfaces or extending the base classes gives your Actions certain
>inherent abilities, or marks them as being usable by the framework in
>certain ways it otherwise wouldn't know it could. When you read that
>WW/S2 Actions are POJOs, that's true, but to be more accurate it should
>say they *can* be POJOs... unlike in S1 where you had to extend Action,
>that is no longer required, but you'll give up some things if you don't,
>or if you don't extend some interfaces.
>
>Frank
>
>--
>Frank W. Zammetti
>Founder and Chief Software Architect
>Omnytex Technologies
>http://www.omnytex.com
>AIM/Yahoo: fzammetti
>MSN: fzammetti@hotmail.com
>Author of "Practical Ajax Projects With Java Technology"
> (2006, Apress, ISBN 1-59059-695-1)
>and "JavaScript, DOM Scripting and Ajax Projects"
> (2007, Apress, ISBN 1-59059-816-4)
>Java Web Parts - http://javawebparts.sourceforge.net
> Supplying the wheel, so you don't have to reinvent it!
>
>On Thu, May 10, 2007 4:01 pm, Rick Schumeyer wrote:
> > It's quite possible I'm confused, but I thought that actions in S2 were
> > now POJOs. In Webwork in Action, for example, we see:
> >
> > public class HelloWorld implements Action
> >
> > but in the blank application we see
> >
> > public class ExampleSupport extends ActionSupport
> >
> > Is this an example where Webwork in Action is out-of-date, or can you
> > still do something like that with S2? If so, is there a reason why I
> > *would not* want to use POJOs with an Action interface?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Are S2 actions POJOs?
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Your Actions *can* be POJOs... they also *can* implement certain
interfaces, and they *can* extend certain base classes... implementing the
interfaces or extending the base classes gives your Actions certain
inherent abilities, or marks them as being usable by the framework in
certain ways it otherwise wouldn't know it could. When you read that
WW/S2 Actions are POJOs, that's true, but to be more accurate it should
say they *can* be POJOs... unlike in S1 where you had to extend Action,
that is no longer required, but you'll give up some things if you don't,
or if you don't extend some interfaces.
Frank
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Author of "Practical Ajax Projects With Java Technology"
(2006, Apress, ISBN 1-59059-695-1)
and "JavaScript, DOM Scripting and Ajax Projects"
(2007, Apress, ISBN 1-59059-816-4)
Java Web Parts - http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!
On Thu, May 10, 2007 4:01 pm, Rick Schumeyer wrote:
> It's quite possible I'm confused, but I thought that actions in S2 were
> now POJOs. In Webwork in Action, for example, we see:
>
> public class HelloWorld implements Action
>
> but in the blank application we see
>
> public class ExampleSupport extends ActionSupport
>
> Is this an example where Webwork in Action is out-of-date, or can you
> still do something like that with S2? If so, is there a reason why I
> *would not* want to use POJOs with an Action interface?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org