useraction.java

来自「企业内部培训系统」· Java 代码 · 共 89 行

JAVA
89
字号
package cn.com.tarena.ecport.web.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.apache.struts.actions.MappingDispatchAction;import cn.com.tarena.ecport.biz.IUserBusiness;import cn.com.tarena.ecport.biz.factory.BusinessFactory;import cn.com.tarena.ecport.dao.IUserDAO;import cn.com.tarena.ecport.dao.factory.DAOFactory;import cn.com.tarena.ecport.pojo.ContactInfo;import cn.com.tarena.ecport.pojo.Country;import cn.com.tarena.ecport.pojo.Province;import cn.com.tarena.ecport.pojo.User;public class UserAction extends MappingDispatchAction {	//在页头通过"用户管理"超链接进入userinfo页面	public ActionForward listUserinfo(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response){				return mapping.findForward("userinfo");	}		//注册用户	public ActionForward registerUserinfo(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response){				User user=new User();		ContactInfo contactInfo=new ContactInfo();		Country country=new Country();		Province province= new Province();				String userid=request.getParameter("userid");		String password=request.getParameter("password");		Long countryid=Long.parseLong(request.getParameter("country"));		Long provinceid=Long.parseLong(request.getParameter("province"));						String street1=request.getParameter("street1");		String street2=request.getParameter("street2");		String city=request.getParameter("city");		String zip=request.getParameter("zip");		String email=request.getParameter("email");		String homephone=request.getParameter("homephone");		String cellphone=request.getParameter("cellphone");		String officephone=request.getParameter("officephone");								user.setContactinfo(contactInfo);		contactInfo.setUsers(user);						user.setUserid(userid);		user.setPassword(password);				contactInfo.setStreet1(street1);		contactInfo.setStreet2(street2);		contactInfo.setCity(city);		contactInfo.setZip(zip);		contactInfo.setEmail(email);		contactInfo.setHomephone(homephone);		contactInfo.setCellphone(cellphone);		contactInfo.setOfficephone(officephone);				country.setId(countryid);		province.setId(provinceid);				contactInfo.setCountry(country);		contactInfo.setProvince(province);									IUserBusiness ob = (IUserBusiness) BusinessFactory.getBusiness(IUserBusiness.class				.getName());		ob.registerUser(user);		return mapping.findForward("index");	}					}

⌨️ 快捷键说明

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