cancel by struts

Discussions

General J2EE: cancel by struts

  1. cancel by struts (1 messages)

    Hi, there:
    I have a question regarding the submit and cancel button using the
     
    <html:submit> and <html:cancel> tag in a form. In the FormAction class, how do I tell whether the user clicked on the submit or the cancel button? Seems to me that either the user clicked on the submit or the cancel, the code that is in perform method of the action class would be executed. Could sb give any hints?
     
    Thanks.
     
    sanjay

    Threaded Messages (1)

  2. cancel by struts[ Go to top ]

    yes, these go to the perform method of the action class.

    You can check the request for submit if you want to do various processing based on that. For cancel, you can use
    something like

     if (isCancelled(request))
          return mapping.findForward("back");

    I guess also, you could use htm:button tag with onclick
    method doing a window.location= type of thing. I hate javascript though.

    -Newt