registeraction.java

来自「SSH2实现增删改查的小DEMO」· Java 代码 · 共 46 行

JAVA
46
字号
package com.ghy.action;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.ghy.data.Customer;
import com.ghy.service.CustomerServiceIfc;
import com.opensymphony.xwork2.ActionSupport;

public class RegisterAction extends ActionSupport {
private Customer customer ;
	
	private CustomerServiceIfc customerServiceIfc;
	
	private ArrayList customers ;
	public ArrayList getCustomers() {
		return customers;
	}
	public void setCustomers(ArrayList customers) {
		this.customers = customers;
	}
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	public CustomerServiceIfc getCustomerServiceIfc() {
		return customerServiceIfc;
	}
	public void setCustomerServiceIfc(CustomerServiceIfc customerServiceIfc) {
		this.customerServiceIfc = customerServiceIfc;
	}
	
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		customerServiceIfc.saveCustomer(customer);
		ArrayList arrayList = customerServiceIfc.findAllCustomer();
		customers = arrayList;
		return SUCCESS;
	}
}

⌨️ 快捷键说明

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