I have a wizard-type flow for an enrollment process. I use a session scoped
EnrollmentBean to store the form-beans as they are gathered through the process.
If the user cancels the enrollment anywhere along the way, I remove the
EnrollmentBean from the session and forward to a "Your enrollment has been
cancelled" page.

If, after canceling, the pesky user uses history or the back button and tries to
keep going with their cancelled enrollment, we have an obvious problem. I was
starting off with the idea of simply checking for the EnrollmentBean in my
actions, and if it's gone, forwarding to a "You ding-bat, you are trying to
finish off a cancelled enrollment" page. It seemed like it was going to work,
even though I hated having the "EnrollmentBean check" code in a bunch of
different places. Well, the whole thing fell apart when it came to Actions that
were just ForwardActions:

<action
    path="/EnrollAddressList"
    type="org.apache.struts.actions.ForwardAction"
    parameter="/pages/EnrollAddressList.jsp"/>

Nowhere to intercept execution (that I know of) before the jsp tries to use the
EnrollmentBean. Rats.

Now I'm contemplating using a Servlet Filter (never tried that before) to check
for the EnrollmentBean in the session for all my Enroll*.do paths, and throw my
own EnrollmentDingBat exception if there's no Enrollment Bean. Then use a
<global-exception> to handle it.

Two questions to those of you who know more than I do (this is my first Struts
application):

1. Does the Servlet filter seem a good solution?
2. If I throw an EnrollmentDingBat exception from said Servlet Filter, will a
handler defined in <global-exceptions> catch it? My suspicion is that the filter
might executing too early, before struts mechanics cut in.

No, three questions:

3. Any better ideas?

Q


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to