On 02-03-2009 at 08:35, AK wrote:
> I'd like some help figuring out how I can write "cleaner" action beans.
> 
> In a blog post by Christian Nelson, Stripes: A Successful First Project 
> (http://blog.carbonfive.com/2009/02/java/stripes-a-succesful-first-project), 
> he writes:
> 
> "We keep our Actions simple and lightweight, deferring all non-display 
> logic to transactional, spring-managed services. I.ve seen examples where 
> Actions are directly interacting with the database, a pattern I 
> discourage."

For your basic CRUD, this is indeed not needed: a generic ActionBean can do
all you need. However, for more advanced stuff like resetting a password to
a random value, or executing a workflow action, this is not sufficient.

In that case you either need to put this in your ActionBean, or you need to
introduce yet another layer (for example a session bean) to handle the logic.


[...]
> Right now, I'm finding my beans are getting pretty busy (even if you take 
> out logging).  An example of one of my ActionBeans can be found here:
> 
>       http://gist.github.com/71014
> 
> Any thoughts and guidance would be appreciated.

This looks reasonable. Expecially if you make the getter & setter abstract,
and add abstract getters & setters for a primary key object (operating on
your entity bean). Using that you can make a generic ActionBean to handle
all CRUD.


Oscar

-- 
   ,-_  Oscar Westra van holthe - Kind      http://www.xs4all.nl/~kindop/
  /() )
 (__ (  Progress is made by lazy men looking for easier ways to do things.
=/  ()  -- Robert Heinlein

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to