Merrill
Consultant, Sima Solutions
Originally posted by Merrill Higginson:
One solution would be to use an html:cancel tag for your back button. Struts will skip validation when this button is pressed. In your action, you can tell whether the cancel button was pressed by calling the isCancelled() method on your action's superclass.
An important point to remember, though, is that if you're using Struts version 1.2.9 or later, you must specify cancellable="true" in your action mapping.
Merrill
Consultant, Sima Solutions
Originally posted by Merrill Higginson:
Both buttons could still be html:cancel buttons. You could add a hidden field to your form and then use the onclick event of the buttons to set the hidden field to different values depending on which button was pressed. You could then use the value of the hidden field in your action class to determine which cancel button was pressed.
Another solution would be to make the back button a link rather than a submit button. I'm guessing that if the user hits the back button, you don't care about preserving any of the data she might have entered or changed on the form. If it has to be a button, you can use the html:button tag with an onclick event using JavaScript to navigate to the previous page.
[ September 08, 2007: Message edited by: Merrill Higginson ]
Merrill
Consultant, Sima Solutions
Thanks & Regards
Sidharth Pallai
Merrill
Consultant, Sima Solutions
Don't get me started about those stupid light bulbs. |