package cn.muke.ssh.action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import cn.muke.ssh.domain.Produce;
import cn.muke.ssh.service.ProduceService;
public class Produceaction extends ActionSupport implements ModelDriven<Produce> {
private Produce produce = new Produce();
@Override
public Produce getModel() {
// TODO Auto-generated method stub
return produce;
}
private ProduceService produceService;
public void setProduceService(ProduceService produceService) {
this.produceService = produceService;
}
public String save(){
System.out.println("save");
produceService.save(produce);
return NONE;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<bean id="produceService" class="cn.muke.ssh.service.ProduceService">
<property name="dao" ref="dao"></property>
</bean>
<bean id="dao" class="cn.muke.ssh.dao.ProduceDao">
</bean>
</beans>