> In the Struts User Guide at > <http://jakarta.apache.org/struts/userGuide/introduction.html> The > statement is made: > > "For the simplest applications, an Action object may sometimes handle the > business logic associated with a request. However, in most cases, an > Action object should invoke another object, usually a JavaBean, to perform > the actual business logic. This lets the Action focus on error handling > and control flow, rather than business logic. To allow reuse on other > platforms, business-logic JavaBeans should not refer to any Web > application objects. The Action object should translate needed details > from the HTTP request and pass those along to the business-logic beans as > regular Java variables. " > > It seems clear that the author advocates the business logic to be > separated from, and ignorant of, web environment classes (even Struts > classes) to maximize reusability. But we need help to settle a > misunderstanding of what is meant by the term "JavaBeans" in this passage. > > > Question 1: Which interpretation is correct: > 1. The Business Logic should be in vanilla Java Classes that perform > the business logic and follow Java Bean protocol (such as using getters > and setters). > It doesn't seem that introspection to allow visual development is > relevant here - hence the confusion over the meaning of "JavaBean." > 2. All business logic that has been factored out of the Action should > be in EJBs. > 3. Either 1 or 2 depending on what makes sense to make into EJBs. > > Then if the answer to Question 1 is 1 or 3, I have two follow on > questions: > > Question 2: Is it okay for the business logic classes to run on the same > tier (JVM) as the Action? > Question 3: Is it okay to create separate instances of the business > logic classes to remain thread safe or should they be Singletons (as the > Actions are). If they are JavaBeans, this seems to imply the are instance > based (i.e. not singletons) and thus can have instance variables as > needed. > > One last question, if the answer is that they could be EJBs, what > criteria do you apply to determine good candidates for EJBs? > > Please elaborate on any of the above as you see fit. > > > Joel Goldberg > >
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>