I'm a bit confused about the implementation details of the model 2
architecture.

I've read posts where people advocate the use of only one servlet, which
acts as the interaction controller (a router/traffic cop). This obviously
provides a centralized hook for security, error handling, etc.

(Side Note: The IBM Redbook "Developing an eBusiness Application..."
(SG24-5423) shows a use case model mapping to multiple servlets. Basically,
each use case had its own servlet (acting as an interaction controller).
This seems to have the advantage of chunking the application along use case
lines allowing for good separation etc. It also  doesn't preclude the
redirection model....)

If I understand the single servlet Model 2 approach, then a single user
interaction looks like this:
1. User fills out form in a jsp page  (I'll call this the SourcePage).
2. User submits the page... (an http request)
3. ...to the single servlet (the routingServlet).
4. The routingServlet creates an ActionBean (if it didn't already exist).
5. The routingServlet invokes myActionBean.doWork().
6a. If doWork() failed, then create error object, add it to the request and
redirect back to SourcePage.
6b. If doWork() succeeded, then the routingServlet redirects the request to
a jsp page. (I'll call this the TargetPage).

My confusion lies in Who is responsible for knowing what?

My guess is that the SourcePage should specify both what ActionBean will be
used to process it (which was probably already instantiated with default
values coming in, anyway) as well as the TargetPage. So each jsp page needs
just a coupla' hidden fields, e.g.
actionBean="com.foo.orderentry.OrderLineEdit" and
targetPage="com.foo/OrderEntry/DisplayOrder.jsp".

The TargetPage then represents the "Happy Days" scenario (where the page
designer intends the application flow to go next) while allowing for the
routingServlet and the TargetPage to redirect, if necessary. (Perhaps, the
actionBean could be architected to specify exception page targets when not
simply redirecting back to the SourcePage w/ an error....)

So, where have I missed the boat? Any help/comments would be greatly
appreciated!

TIA,

Mike

===========================================================================
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