createaccountaction.java

来自「一个很不错的网上小型购物系统」· Java 代码 · 共 35 行

JAVA
35
字号
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
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 service.AccountService;
import service.ServiceFactory;
import domain.Account;
import domain.Address;

public class CreateAccountAction extends Action {
	AccountService accountService = ServiceFactory.getAccountService();

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Account account = new Account();
		Address address = new Address();
		BeanUtils.copyProperties(account, form);
		BeanUtils.copyProperties(address, form);
		account.setAddress(address);
		accountService.register(account);
		return null;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?