How about a slight variation on #1?  

interface BusinessBeanThingie {}
class YourActionForm implements BusinessBeanThingie {}
class YourSessionBean { YourSessionBean(BusinessBeanThingie bbt) {} }

Because YourActionForm implements BusinessBeanThingie, you can pass it
to your session bean in your perform method just like your first
alternative.  However, YourSessionBean is no longer dependent on
YourActionForm; it's not even dependent on Struts!  You end up trading a
little more work (creating the business interface) for a less tightly
coupled -- and therefore more reusable -- Session bean.

Personally, I don't like passing containers because it's not obvious
from the code what they contain.  I've had good success with the
interface approach, though.  Good luck.
--
Jim

"Assenza, Chris" wrote:
> 
> Hello! :)
> 
> Our dev team for a big enterprise app has been going back and forth on how
> to send the data from the ActionForm to a Session bean.  We have a number of
> options and I was hoping for some feedback because we've had enough talk and
> its time to decide! :) (Our architecture is as of now to use only Session
> Beans, but we will probably start wrapping Entity beans with Session beans
> eventually).
> 
> 1) Send the ActionForm to the EJB from Action perform()
>         Pros: Easy and less work
>         Cons: Defeats the purpose of Struts in that the Business Logic is no
> longer self-contained and independent of the V in MVC :). If for whatever
> reason we overhaul the front end and remove Struts, we're not in the ideal
> position to do so.
> 
> 2) Create a special utility class that with special methods, that when
> invoked from the Action perform() method, will put the data from ActionForm
> into a HashTable.  Then, we'll pass that object to the EJB and do whatever
> business logic is necessary.
> 
> 3) JMS - Sort of an adaptation of the number 2 as JMS uses HashMaps and the
> like but it follows a specific spec and has a lot more to it then what we'd
> be doing above.  However, none of us really know much about JMS yet. :|
> Obviously we can learn, but is it a recommended path to follow from your
> experience? (in regards to Struts specifically as well).
> 
> 4) RMI or RMI-IIOP.  Create a remote object within the client and pass the
> remote reference to the EJB.  The EJB can then use this reference to make
> callbacks to the client.  Not sure about this one either, seems rather
> inefficient.
> 
> Oh, and one other question, since DataTable (Java collection) is basically
> made up of vectors, can one use the iterate tag to move through it?
> 
> Any thoughts or experiences?? :)
> 
> Thanks,
> 
> Chris Assenza

Reply via email to