Controller / EJB


Using action classes as adapters and session EJBs for business logic sounds like a good way to go. Is also using EJBs as actionforms is a good idea because they are a good target for object reuse

Actually, I do not believe it is a good idea to re-use an EJB as an ActionForm. In fact, this will be somewhat more difficult in 1.0, now that ActionForm is a class rather than an interface.

The reasoning behind my belief goes like this:

So, my bottom line recommendation is that you plan on building simple JavaBeans for your ActionForms. Most of the time, an ActionForm will have just getters and setters, with no error checking (other than a validate() method if you want to use it, plus the reset() method). PropertyUtils also has a convenience function that can copy properties with like names from your EJB to the ActionForm bean (or vice versa), to reduce the amount of tedious code that this
approach implies. And, at some future point, it's reasonable to expect a development tool to be able to auto-generate ActionForm beans for you. 

Using an EJB as a bean that provides data values used in the presentation, on the other hand, is pretty easy. Just store the client-side instance you get back from the EJB server as a request attribute or session attribute -- from the
perspective of the Struts custom tags, this EJB just looks like a JavaBean with getter methods, so they don't care that it is really an EJB. NOTE: If the EJBs are really on a remote server this could have some performance impact -- you
might be better served to copy data into local beans in that case.