📄 registeraction.java
字号:
package cn.edu.yuyh.register.action;import cn.edu.yuyh.register.actionform.*;import cn.edu.yuyh.register.bean.*;import cn.edu.yuyh.tools.*;import org.apache.struts.action.*;import java.sql.*;import javax.servlet.http.*;public class RegisterAction extends Action { public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { Connection conn = null; ActionForward forward = actionMapping.findForward("success"); RegisterBean registerBean = new RegisterBean(); RegisterActionForm myForm = (RegisterActionForm) actionForm; PublicFunction function = new PublicFunction(); try { conn = function.getConnection(); if(Boolean.TRUE.equals(registerBean.doRegister(myForm, httpServletRequest, conn))) { function.warn(httpServletRequest, "注册成功"); } else { forward = actionMapping.findForward("failure"); function.warn(httpServletRequest, "注册失败,请重新注册"); myForm.reset(actionMapping,httpServletRequest); } } catch (Exception e) { e.printStackTrace(); forward = actionMapping.findForward("failure"); function.error(httpServletRequest,e.toString()); myForm.reset(actionMapping,httpServletRequest); } finally { try{ conn.close(); } catch(Exception e){ e.printStackTrace(); } } return forward; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -