Hi,

I would like to ask conceptually a question of how 'fat' JavaBeans can be in
model 2.
Guided purely by object-oriented principles, I would probably keep
Action/Command classes in a role of a Factory class, i.e. instantiate bean,
initialize it and return to the caller (JSP). Let the bean keep its inner
logic, which would be class members and operations on them. That would
probably include making JDBC calls and other relevant business
functionality. Bean can also have an aggregate (or containment)
relationships with other classes designed to help it perform its functions.
The coupling between Action/Command class (serving in Factory Role) and
related JavaBean class in that case is minimal, which provides for better
maintainability.
Another approach is to leave business logic in Command/Action class and let
the bean be just a placeholder for information (text, numerical, date) to
pass to JSP and back. An advantage of this approach is that apparently that
passing "lean" bean deprived of any functionality except for mutators and
accessors most likely should be faster. The drawback is really tight
coupling between Action/Command class and the bean class, where
Action/Command class has intimate knowledge of the bean structure.
Using this last approach, if we think of the architecture layers, the beans
would likely to reside in domain:
   Layers             Components
1. Presentation   JSP, tag library
2. Application    ActionServlet
3. Services             Action implementors(or Command per GoF)
4. Domain               Bean
5. Persistence  JDBC
Using the first approach, both services and domain layers would be
implemented by a bean.

Having implemented my first JSP model 2 pages using the second approach, I
am still having doubts as to which approach is better.

Vadim Shun
NEW Corp
Dulles, VA

P.S. I believe the subject was briefly touched before, but it was rather
part of bigger message and I am not sure what the conclusion was then. I
still hope I am not duplicating.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to