資源簡介
簡單的SSH項目整合案例,功能:客戶信息的增,刪,改,查,使用注解,事務,dataSource, C3P0 數據源
代碼片段和文件信息
package?top.vkiss.ssh.action;
import?java.util.List;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.stereotype.Controller;
import?com.opensymphony.xwork2.ModelDriven;
import?top.vkiss.ssh.domain.Customer;
import?top.vkiss.ssh.service.CustomerService;
@Controller(“customerAction“)
public?class?CustomerAction?implements?ModelDriven{
@Autowired
private?CustomerService?cs;
public?List?getList()?{
return?list;
}
public?void?setList(List?list)?{
this.list?=?list;
}
private?int?id;
private?int[]?ids;
private?List?list;
private?Customer?customer?=?new?Customer();
public?Customer?getCustomer()?{
return?customer;
}
public?void?setCustomer(Customer?customer)?{
this.customer?=?customer;
}
public?int?getId()?{
return?id;
}
public?void?setId(int?id)?{
this.id?=?id;
}
public?int[]?getIds()?{
return?ids;
}
public?void?setIds(int[]?ids)?{
this.ids?=?ids;
}
public?CustomerService?getCs()?{
return?cs;
}
public?void?setCs(CustomerService?cs)?{
this.cs?=?cs;
}
//添加客戶
public?String?addCustomer(){
try?{
System.out.println(customer);
cs.addCustomer(customer);
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
return?“addFailure“;
}
return?“success“;
}
//刪除客戶
public?String?delCustomer(){
try?{
cs.delCustomer(id);
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
return?“delFailure“;
}
return“success“;
}
//修改客戶
public?String?editCustomer(){
try?{
cs.updateCustomer(customer);
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
return?“editFailure“;
}
return“success“;
}
//查詢一名客戶
public?String?queryOneCustomer(){
try?{
System.out.println(111111);
customer?=?cs.getCustomerById(id);
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
return?“qusryoneFailure“;
}
System.out.println(“customer“+customer);
return“success“;
}
//查詢所有客戶
public?String?queryAllCustomer(){
try?{
? list?=?cs.queryAll();
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
return?“qusryAllFailure“;
}
//System.out.println(list.toString());
return“success“;
}
//刪除多條客戶
public?String?delSCustomer(){
try?{
cs.delCustomers(ids);
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
return?“delsFailure“;
}
return“success“;
}
@Override
public?Customer?getModel()?{
//?TODO?Auto-generated?method?stub
return?customer;
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-08-24?15:33??SSH\
?????文件????????1168??2018-08-14?20:31??SSH\.classpath
?????文件????????1053??2018-08-14?18:29??SSH\.project
?????目錄???????????0??2018-08-24?15:33??SSH\.settings\
?????文件?????????564??2018-08-14?18:29??SSH\.settings\.jsdtscope
?????文件?????????364??2018-08-14?18:29??SSH\.settings\org.eclipse.jdt.core.prefs
?????文件?????????543??2018-08-14?18:48??SSH\.settings\org.eclipse.wst.common.component
?????文件?????????414??2018-08-14?18:29??SSH\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2018-08-14?18:29??SSH\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2018-08-14?18:29??SSH\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2018-08-24?15:33??SSH\conf\
?????文件????????2417??2018-08-23?18:22??SSH\conf\applicationContext.xm
?????文件??????????97??2018-08-14?20:06??SSH\conf\db.properties
?????文件?????????738??2018-08-14?13:43??SSH\conf\hibernate.cfg.xm
?????文件????????1893??2018-08-15?08:48??SSH\conf\struts.xm
?????目錄???????????0??2018-08-24?15:33??SSH\src\
?????目錄???????????0??2018-08-24?15:33??SSH\src\top\
?????目錄???????????0??2018-08-24?15:33??SSH\src\top\vkiss\
?????目錄???????????0??2018-08-24?15:33??SSH\src\top\vkiss\ssh\
?????目錄???????????0??2018-08-24?15:33??SSH\src\top\vkiss\ssh\action\
?????文件????????2847??2018-08-15?09:39??SSH\src\top\vkiss\ssh\action\CustomerAction.java
?????目錄???????????0??2018-08-24?15:33??SSH\src\top\vkiss\ssh\dao\
?????文件?????????439??2018-08-14?19:05??SSH\src\top\vkiss\ssh\dao\CustomerDao.java
?????文件????????1506??2018-08-14?21:30??SSH\src\top\vkiss\ssh\dao\CustomerDaoImpl.java
?????目錄???????????0??2018-08-24?15:33??SSH\src\top\vkiss\ssh\domain\
?????文件?????????703??2018-08-14?18:54??SSH\src\top\vkiss\ssh\domain\Customer.hbm.xm
?????文件????????1255??2018-08-14?18:52??SSH\src\top\vkiss\ssh\domain\Customer.java
?????目錄???????????0??2018-08-24?15:33??SSH\src\top\vkiss\ssh\service\
?????文件?????????507??2018-08-14?19:10??SSH\src\top\vkiss\ssh\service\CustomerService.java
?????文件????????1664??2018-08-14?21:40??SSH\src\top\vkiss\ssh\service\CustomerServiceImpl.java
?????目錄???????????0??2018-08-24?15:33??SSH\WebRoot\
............此處省略72個文件信息
- 上一篇:mod_wsgi-windows
- 下一篇:X-Scan掃描工具
評論
共有 條評論