newaccountformaction.java
来自「Spring +Web 的完整 MyEclipse 项目源码,使用者可以作为入门」· Java 代码 · 共 33 行
JAVA
33 行
package org.digitstore.web.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.digitstore.domain.Account;
import org.digitstore.web.struts.form.AccountActionForm;
import org.digitstore.service.*;
public class NewAccountFormAction extends BaseAction {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
AccountActionForm workingAcctForm = new AccountActionForm();
request.getSession().removeAttribute("workingAccountForm");
request.getSession()
.setAttribute("workingAccountForm", workingAcctForm);
ProductManager manager = ManagerFactory.createProductManager();
if (workingAcctForm.getAccount() == null) {
workingAcctForm.setAccount(new Account());
}
if (workingAcctForm.getCategories() == null) {
workingAcctForm.setCategories(manager.getCategoryList());
}
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?