📄 registeraction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.validator.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.validator.struts.form.RegisterForm;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* MyEclipse Struts
* Creation date: 08-12-2007
*
* XDoclet definition:
* @struts.action input="/register.jsp" scope="request" validate="true"
* @struts.action-forward name="success" path="/registerOk.jsp"
* @struts.action-forward name="failure" path="/register.jsp"
*/
public class RegisterAction extends Action {
/*
* Generated Methods
*/
private Log log = LogFactory.getFactory().getInstance(this.getClass().getName());
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// Was this transaction cancelled?
if (isCancelled(request)) {
if (log.isInfoEnabled()) {
log.info(
" "
+ mapping.getAttribute()
+ " - Registration transaction was cancelled");
}
removeFormBean(mapping, request);
return (mapping.findForward("success"));
}
return mapping.findForward("success");
}
/**
* Convenience method for removing the obsolete form bean.
*
* @param mapping The ActionMapping used to select this instance
* @param request The HTTP request we are processing
*/
protected void removeFormBean(
ActionMapping mapping,
HttpServletRequest request) {
// Remove the obsolete form bean
if (mapping.getAttribute() != null) {
if ("request".equals(mapping.getScope())) {
request.removeAttribute(mapping.getAttribute());
} else {
HttpSession session = request.getSession();
session.removeAttribute(mapping.getAttribute());
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -