MBP wrote:
> Hi
> I'm in the exact same situation. I need to present data from several major
> areas of functionality on one web-page, so do I write a servlet for each
> area or do I write a master-servlet that uses business objects to provide
> the data?
> If I write a servlet for each area of functionality, I face the problem that
> they are all on the same logical level and should therefore know nothing
> about the others. Result: I need a master-servlet that is logically placed
> above the others.
> If I need a master-servlet, then why should each area of functionality be
> implemented as servlets. In my opinion they should be business objects.
> I think I've read the following, or at least words to that effect, some
> weeks ago on this mailing list: Servlets are for user interfaces. Use
> servlets for implementing the user dialoque. Use 'plain' java classes to
> implement your business logic.
>
An architecture design pattern popularly known as "Model 2" advocates a slight
variation on your suggested approach:
* Use a single "controller" servlet to receive all
requests and decide what to do (i.e. which
business methods to call).
* Use Java classes to implement the business
logic, creating or updating JavaBeans stored
as either request attributes or session attributes
to save things that will be needed in the next
page sent to the user.
* Use JSP pages (accessed from the controller
servlet by RequestDispatcher.forward()) to
create the user interface, using the JavaBeans
that were stored by the business logic to get
the dynamic part of the display.
One implementation of this approach you might find useful is the Struts
framework, available at <http://jakarta.apache.org/struts>.
>
> Anyone disagree?
>
> Best regards
> Michael B. Pedersen
>
Craig McClanahan
====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00): Sun Technical Briefing
Session T06 (24-Oct 14h00-15h00): Migrating Apache JServ
Applications to Tomcat
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html