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