editregistration.gv
来自「struts框架的script版本. 用于学习strust框架」· GV 代码 · 共 64 行
GV
64 行
import java.lang.reflect.InvocationTargetException;import javax.servlet.ServletException;import org.apache.commons.beanutils.PropertyUtils;import org.apache.struts.webapp.example.*;act = request.getParameter("action");if (act == null) { act = "Create"; if (log.isDebugEnabled()) { log.debug("EditRegistrationAction: Processing " + act + " act"); }} user = null;// Is there a currently logged on user?if (!"Create".equals(act)) { user = (User) session.getAttribute(Constants.USER_KEY); if (user == null) { if (log.isDebugEnabled()) { log.debug(" User is not logged on in session " + session.getId()); } struts.setForwardName("logon"); return; }}form = struts.form;if (user != null) { if (log.isTraceEnabled()) { log.trace(" Populating form from " + user); } try { PropertyUtils.copyProperties((Object)form, user); form.action=act; form.password=null; form.password2=null; } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t == null) t = e; log.error("RegistrationForm.populate", t); throw new ServletException("RegistrationForm.populate", t); } catch (Throwable t) { log.error("RegistrationForm.populate", t); throw new ServletException("RegistrationForm.populate", t); }}// Set a transactal control token to prevent double postingif (log.isTraceEnabled()) { log.trace(" Setting transactal control token");}struts.action.saveToken(request);// Forward control to the edit user registration pageif (log.isTraceEnabled()) { log.trace(" Forwarding to 'success' page");}struts.setForwardName("success");
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?