src/com/jiudai/action/CustomerAction.java

(完整代码) 1KB

package com.jiudai.action;

import com.jiudai.dao.CustomerDAO;
import com.jiudai.domain.Customer;
import com.opensymphony.xwork2.ActionContext;

public class CustomerAction {
	
	private Customer customer;
	
	private CustomerDAO customerDAO = new CustomerDAO();
	
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public String ModifyCustomer() {
		System.out.println(customer.getCustomername()); 
		ActionContext ctx = ActionContext.getContext();
		try {
			customerDAO.ModifyCustomer(customer);
			ctx.put("message", "客户信息修改成功!");
		} catch(Exception ex) {
			System.out.println(ex.getMessage());
			ctx.put("message", "客户信息修改失败!");
		} 
		return "message";  
	}
	
	public String DeleteCustomer() {
		ActionContext ctx = ActionContext.getContext();
		try {
			customerDAO.DeleteCustomer(customer);
			ctx.put("result", "客户信息删除成功!");
		} catch(Exception ex) {
			ctx.put("result", "客户信息删除失败!");
		}
		return "customer_manage_view";
	}
	
	public String AddCustomer() {
		ActionContext ctx = ActionContext.getContext();
		try {
			customerDAO.AddCustomer(customer);
			ctx.put("result", "客户信息添加成功!");
		} catch (Exception ex) {
			ctx.put("result", "客户信息添加失败!");
		}
		return "customer_add_view";
	}
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。