If my jsp page, I have two buttons, one is html:submit, the other one is html:cancel, how could I create a test case for html:cancel? In my Action, I am using :if (isCancelled(request)) to determine whether the html:cancel is pushed, but I don't know how to setup this html:cancel button in my testcase. BTW, I am using mocktestcase
Thanks a lot and have a great day,
Joined: Oct 27, 2003
I have figured it out, basically, ActionServlet decides whether the user clicks the cancel button by checking a request parameter with the key of "org.apache.struts.taglib.html.CANCEL" in resource bundle.
So if we add following request parameter in our testcase: addRequestParameter(Constants.CANCEL_PROPERTY,"CANCEL");