1 18 19 package org.apache.struts.webapp.validator; 20 21 import javax.servlet.http.HttpServletRequest ; 22 import javax.servlet.http.HttpServletResponse ; 23 import javax.servlet.http.HttpSession ; 24 25 import org.apache.commons.logging.Log; 26 import org.apache.commons.logging.LogFactory; 27 import org.apache.struts.action.Action; 28 import org.apache.struts.action.ActionForm; 29 import org.apache.struts.action.ActionForward; 30 import org.apache.struts.action.ActionMapping; 31 32 36 public final class RegistrationAction extends Action { 37 38 41 private Log log = LogFactory.getFactory().getInstance(this.getClass().getName()); 42 43 58 public ActionForward execute( 59 ActionMapping mapping, 60 ActionForm form, 61 HttpServletRequest request, 62 HttpServletResponse response) 63 throws Exception { 64 65 if (isCancelled(request)) { 67 if (log.isInfoEnabled()) { 68 log.info( 69 " " 70 + mapping.getAttribute() 71 + " - Registration transaction was cancelled"); 72 } 73 74 removeFormBean(mapping, request); 75 76 return (mapping.findForward("success")); 77 } 78 79 return mapping.findForward("success"); 80 } 81 82 88 protected void removeFormBean( 89 ActionMapping mapping, 90 HttpServletRequest request) { 91 92 if (mapping.getAttribute() != null) { 94 if ("request".equals(mapping.getScope())) { 95 request.removeAttribute(mapping.getAttribute()); 96 } else { 97 HttpSession session = request.getSession(); 98 session.removeAttribute(mapping.getAttribute()); 99 } 100 } 101 } 102 } 103 | Popular Tags |