www.pudn.com > ssh1.rar > RegisterAccountAction.java
/**
*
*/
package com.tarena.account.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.springframework.context.ApplicationContext;
import org.springframework.web.struts.ActionSupport;
import com.tarena.account.form.RegisterAccountForm;
import com.tarena.service.IAccountService;
/**
* @author dong xuyuan
*
*/
public class RegisterAccountAction extends ActionSupport {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm actionForm,
HttpServletRequest request, HttpServletResponse response) throws Exception {
System.out.println("enter the register account action");
ApplicationContext ctx = this.getWebApplicationContext();
IAccountService accountServcie = (IAccountService)ctx.getBean("accountservice");
RegisterAccountForm form = (RegisterAccountForm)actionForm;
accountServcie.registerAccount(form.getUsername(), form.getPassword(), form.getDescription());
return mapping.findForward("success");
}
}