Hi Mike,
The answer to your question regarding "Who is responsible for knowing what?" hasn't
got
just one answer. One option, as you mention, is using hidden fields in the source
page.
In our case, we configure this in an XML file which is processed at initialization
time by
the controller servlet. This avoids having to go back to the html pages when you
want to make
changes in the configuration.
Another side note is that we don't forward control automatically to the SourcePage
in case of
error. That's another field in the configuration so you can choose if you want to
use another
page or not, and actually, I might add to the Action classes the ability to specify
themselves
their forwarding pages(error, or normal operation), in case you need to decide it
dynamically.
So I guess you didn't miss the boat. It's just that there is more than one boat ;).
Regards,
Dan
Mike LaBudde wrote:
> 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
===========================================================================
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