package com.mkyong.customer.action;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.mkyong.customer.bo.CustomerBo;
import com.mkyong.customer.model.Customer;
import com.opensymphony.xwork2.ModelDriven;
public class CustomerAction implements ModelDriven{
Customer customer = new Customer();
List<Customer> customerList = new ArrayList<Customer>();
CustomerBo customerBo;
//DI via Spring
public void setCustomerBo(CustomerBo customerBo) {
this.customerBo = customerBo;
}
public Object getModel() {
return customer;
}
public List<Customer> getCustomerList() {
return customerList;
}
public void setCustomerList(List<Customer> customerList) {
this.customerList = customerList;
}
//save customer
public String addCustomer() throws Exception{
//save it
customer.setCreatedDate(new Date());
customerBo.addCustomer(customer);
//reload the customer list
customerList = null;
customerList = customerBo.listCustomer();
return "success";
}
//list all customers
public String listCustomer() throws Exception{
customerList = customerBo.listCustomer();
return "success";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Struts2-Spring-Hibernate-Integration-Example.zip (22个子文件)
Struts2Example
.project 886B
pom.xml 3KB
target
.settings
org.eclipse.wst.common.component 540B
org.eclipse.jdt.core.prefs 330B
org.eclipse.wst.common.project.facet.core.xml 229B
database
customer.sql 333B
src
main
resources
com
mkyong
customer
hibernate
Customer.hbm.xml 954B
spring
CustomerBean.xml 745B
config
database
properties
database.properties 131B
spring
DataSource.xml 842B
HibernateSessionFactory.xml 920B
struts.xml 669B
SpringBeans.xml 512B
java
com
mkyong
customer
dao
CustomerDAO.java 222B
impl
CustomerDAOImpl.java 591B
action
CustomerAction.java 1KB
bo
impl
CustomerBoImpl.java 656B
CustomerBo.java 220B
model
Customer.java 980B
webapp
WEB-INF
web.xml 760B
pages
customer.jsp 904B
.classpath 10KB
共 22 条
- 1
资源评论
- xiag_xiag232013-05-30简单实用,很好
- mlwship2013-12-04下来看看自己再整合下,应该没大问题
- hm20082012-05-14好像少了一些文件,LZ查查看看
- gaohoalianga2012-08-07非常经典,很简单,但是很全面
- billing20132013-02-28还不错,貌似maven配置不太对
weiii
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功