⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 useraction.java

📁 网上书城源代码~~在学习JAVA的时候做的
💻 JAVA
字号:
package com.briup.struts;import java.util.HashSet;import java.util.Set;import com.briup.bean.Customer;import com.briup.common.BeanFactory;import com.briup.common.exception.CustomerServiceException;import com.briup.service.ICustomerService;import com.opensymphony.xwork2.ActionContext;public class UserAction {	private Long id;	private String name;	private String password;	private String zip;	private String address;	private String telephone;	private String email;	private Set orderforms = new HashSet(0);		public String getName() {		return name;	}	public void setName(String name) {		this.name = name;	}	public String getPassword() {		return password;	}	public void setPassword(String password) {		this.password = password;	}	@SuppressWarnings("unchecked")	public String login(){		ICustomerService customerService=(ICustomerService) BeanFactory.getBean(BeanFactory.CUSTOMERSERVICE);		Customer customer=null;		ActionContext context=null;		try {			customer=customerService.login(name, password);			context=ActionContext.getContext();			context.getSession().put("customer", customer);			return "success";		} catch (CustomerServiceException e) {			context=ActionContext.getContext();			context.put("error", e.getMessage());			return "error";		}	}	public String regist(){		ICustomerService customerService=(ICustomerService) BeanFactory.getBean(BeanFactory.CUSTOMERSERVICE);		ActionContext context=null;		Customer customer=new Customer();		customer.setName(name);		customer.setPassword(password);		customer.setZip(zip);		customer.setAddress(address);		customer.setTelephone(telephone);		customer.setEmail(email);		try {			customerService.register(customer);			return "success";		} catch (CustomerServiceException e) {			e.printStackTrace();			context=ActionContext.getContext();			context.put("error", e.getMessage());			return "error";		}	}	public String getAddress() {		return address;	}	public void setAddress(String address) {		this.address = address;	}	public String getEmail() {		return email;	}	public void setEmail(String email) {		this.email = email;	}	public Long getId() {		return id;	}	public void setId(Long id) {		this.id = id;	}	public Set getOrderforms() {		return orderforms;	}	public void setOrderforms(Set orderforms) {		this.orderforms = orderforms;	}	public String getTelephone() {		return telephone;	}	public void setTelephone(String telephone) {		this.telephone = telephone;	}	public String getZip() {		return zip;	}	public void setZip(String zip) {		this.zip = zip;	}}

⌨️ 快捷键说明

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