Why do you have two cancel buttons? On Fri, Jun 26, 2009 at 9:20 AM, Sam Wun<swun2...@gmail.com> wrote: > Hi, > > There are 3 buttons on the jsp web page, first one is submit (sign > in), another one is Cancel, the third one is something else. I used > <html:cancel> for the Cancel and something else. > I also included this.isCancelled() conditional check in the execute() > method; as well as included canecellable="true" in the <action path> > in the struts-config.xml file. > But I don't know why the this.isCancelled() method doesn't returned > true in the execute() method. > > Here is the code: > > # cat struts-config.xml > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD > Struts Configuration 1.3//EN" > "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd"> > .... > <action-mappings> > <action path="/onlinepayment_portlet/sign_in" > type="com.ip6networks.onlinepayment.portlet.SignInAction" > name="SignInForm" scope="session" validate="true" cancellable="true" > input="/portlet/onlinepayment_portlet/sign_in.jsp"> > <forward name="sign_in" > path="/portlet/onlinepayment_portlet/sign_in.jsp"></forward> > <forward name="personal_details" > path="/portlet/onlinepayment_portlet/personal_details.jsp"></forward> > <exception key="errors.cancel" > type="org.apache.struts.action.InvalidCancelException" > path="/portlet/onlinepayment_portlet/fool.jsp"></exception> > </action> > ... > > SignInAction.java: > .... > public ActionForward execute( > ActionMapping mapping, ActionForm form, > HttpServletRequest req, > HttpServletResponse res) > throws Exception { > > SignInForm signinForm = (SignInForm) form; > req.getSession().setAttribute("SignInForm", signinForm); > PersonalDetailForm personalDetailForm = new > PersonalDetailForm(); > req.getSession().setAttribute("PersonalDetailForm", > personalDetailForm); > > String email_address = signinForm.getEmailAddress().trim(); > String password = signinForm.getPassword().trim(); > if ( this.isCancelled( req ) ) > { > System.out.println( "About to forward the cancel!" ); > return mapping.findForward( "formTest.cancel" ); > } > .. > > sign_in.jsp: > ... > <html:submit property="sign_in"> > <bean:message key="button.sign_in" /> > </html:submit> > > <html:cancel property="new_visitor"> > <bean:message key="button.new_visitor" /> > </html:cancel> > > <html:cancel property="cancel_checkout"> > <bean:message key="button.cancel_checkout" /> > </html:cancel> > > Your help is much appreciated. > Thanks > Sam > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
--------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org