=========================== // Was this transaction cancelled? if (isCancelled(request)) { return (mapping.findForward("createusersUCcess")); } ===========================
=========================== /** * <p>Returns <code>true</code> if the current form's cancel button was * pressed. This method will check if the <code>Globals.CANCEL_KEY</code> * request attribute has been set, which normally occurs if the cancel * button generated by <strong>CancelTag</strong> was PRessed by the user * in the current request. If <code>true</code>, validation performed * by an <strong>ActionForm</strong>'s <code>validate()</code> method * will have been skipped by the controller servlet.</p> * * @param request The servlet request we are processing * @see org.apache.struts.taglib.html.CancelTag */ protected boolean isCancelled(HttpServletRequest request) {
=========================== /** * <p>Process an <code>HttpServletRequest</code> and create the * corresponding <code>HttpServletResponse</code>.</p> * * @param request The servlet request we are processing * @param response The servlet response we are creating * * @exception IOException if an input/output error occurs * @exception ServletException if a processing exception occurs */ public void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
//省略代码若干 // Process any ActionForm bean related to this request ActionForm form = processActionForm(request, response, mapping); //答案就在这个processPopulate方法中 processPopulate(request, response, form, mapping); if (!processValidate(request, response, form, mapping)) { return; }
/** * Populate the properties of the specified ActionForm instance from * the request parameters included with this request. In addition, * request attribute <code>Globals.CANCEL_KEY</code> will be set if * the request was submitted with a button created by * <code>CancelTag</code>. * * @param request The servlet request we are processing * @param response The servlet response we are creating * @param form The ActionForm instance we are populating * @param mapping The ActionMapping we are using * * @exception ServletException if thrown by RequestUtils.populate() */ protected void processPopulate(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping) throws ServletException {
if (form == null) { return; }
// Populate the bean properties of this ActionForm instance if (log.isDebugEnabled()) { log.debug(" Populating bean properties from this request"); }
// Set the cancellation request attribute if appropriate if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) {