On Wed, 10 Apr 2002, Jing Zhou wrote:
> Date: Wed, 10 Apr 2002 16:42:13 -0500
> From: Jing Zhou <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: The Semantic of 'Cancel' Button
>
> In STRUTS, the 'Cancel' button (the html tag) will populate
> the form beans, if there is one, and skip over the validation.
> The question is why STRUTS need to populate the form beans
> When a 'Cancel' button signal is received.
>
The original thinking for this design is that "cancellation is in the eyes
of the beholder" -- it's the action that decides whether the user really
cancelled or not. In addition, you couldn't do an "are you sure" page
that redisplayed the partially filled out form unless the form bean was
populated.
I can see your reasoning for the opposite behavior as well -- but changing
it now would also be a backwards compatibility issue. At best, we could
make it a configurable behavior. (Or, you can subclass ActionServlet in
1.0 or RequestProcessor in 1.1 and achieve that behavior for yourself by
overriding a single method.)
Craig
> >From my past experiences on UI development, if the 'Cancel' button
> is clicked in a dialog, it will close the dialog and do NOT apply
> any changes to the underlying data buffer, in STRUTS contexts,
> the data buffer is the form beans. If the 'Cancel' button
> is shown on a html page, when it is clicked, it will take the users
> to a different page, which is the first page of a wizard like app,
> or some index page. So in either cases, STRUTS do not need
> to populate the form beans.
>
> More important is that when user click the 'Cancel' button, she
> means to discard whatever data on the screen. But STRUTS
> populate the discarded data into the working form beans, so
> it creates possibility that developers may use wrong data
> in the form beans and make further logic decisions. Actually,
> all the developers need to know is the Action.isCancelled(),
> that is enough, in my opinion.
>
> It gets another problem if the application would like to
> re-produce the screen before the 'Cancel' button is clicked.
> The re-produced screen will show up with the data which
> she means to discard in the previous clicking of the 'Cancel'
> button in the current STRUTS implementation.
>
> In all scenarios I think STRUTS should skip over the population
> of the form beans when the 'Cancel' button is clicked.
> Could anyone clarify this issue? It is possible I am missing
> some other scenarios where populating form beans are
> necessary when clicking the 'Cancel' button.
>
> Thanks,
>
> Jing
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>