package com.zx.test.view.struts2.action;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.BufferedInputStream;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.zx.test.model.entity.Client;
import com.zx.test.model.service.ClientService;
public class ClientsAction extends ActionSupport {
private Integer clientId;
private Client client;
private List<Client> clients;
private ClientService clientsService;
// 上传
private File photo;
private String photoContentType;
private String photoFileName;
// 分页
private Integer pageNum = 0;
private Integer allPages;
private Integer allCounts = 0;
// 验证码
private String code;
public String regist() throws Exception {
InputStream viewFile = new FileInputStream(photo);
String path = ServletActionContext.getServletContext().getRealPath(
"images");
int pos = photoFileName.lastIndexOf(".");
String extention = photoFileName.substring(pos);
client.setViewFile(viewFile);
client.setViewPath(path);
client.setExtention(extention);
HttpSession session = ServletActionContext.getRequest()
.getSession(true);
String randomCode = (String) session.getAttribute("randomCode");
if (code.equals(randomCode)) {
try {
clientsService.regist(client);
return SUCCESS;
} catch (RuntimeException e) {
e.printStackTrace();
return ERROR;
}
} else {
ServletActionContext.getRequest().setAttribute("message", "验证码错误!");
return INPUT;
}
}
public String getAll() throws Exception {
try {
clients = clientsService.getAll();
return SUCCESS;
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return ERROR;
}
}
public String delete() throws Exception {
clientsService.delete(clientId);
return SUCCESS;
}
public Integer getClientId() {
return clientId;
}
public void setClientId(Integer clientId) {
this.clientId = clientId;
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
public List<Client> getClients() {
return clients;
}
public void setClients(List<Client> clients) {
this.clients = clients;
}
public ClientService getClientsService() {
return clientsService;
}
public void setClientsService(ClientService clientsService) {
this.clientsService = clientsService;
}
public File getPhoto() {
return photo;
}
public void setPhoto(File photo) {
this.photo = photo;
}
public String getPhotoContentType() {
return photoContentType;
}
public void setPhotoContentType(String photoContentType) {
this.photoContentType = photoContentType;
}
public String getPhotoFileName() {
return photoFileName;
}
public void setPhotoFileName(String photoFileName) {
this.photoFileName = photoFileName;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getAllPages() {
return allPages;
}
public void setAllPages(Integer allPages) {
this.allPages = allPages;
}
public Integer getAllCounts() {
return allCounts;
}
public void setAllCounts(Integer allCounts) {
this.allCounts = allCounts;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
ssi项目实例 采用struts2、spring2.5、ibatis
共55个文件
jar:23个
xml:8个
class:5个
5星 · 超过95%的资源 需积分: 9 58 下载量 168 浏览量
2012-05-11
08:43:54
上传
评论
收藏 8.22MB RAR 举报
温馨提示
ssi项目实例 采用struts2、spring2.5、ibatis,SSI框架写的一个3个小时面试的小项目~~~希望对新手有帮助~~拿高工资..
资源推荐
资源详情
资源评论
收起资源包目录
ssi项目实例 采用struts2、spring2.5、ibatis.rar (55个子文件)
SSI(struts2+iBatis+spring2)
SSI
.project 1KB
.springBeans 479B
.mymetadata 280B
db.sql 717B
src
struts.xml 825B
com
zx
test
view
struts2
action
ClientsAction.java 4KB
servlet
RandomCodeServlet.java 3KB
model
service
ClientService.java 241B
spring
ClientServiceImp.java 3KB
entity
Client.java 1KB
util
maps
Client.xml 961B
SqlMapConfig.xml 1KB
struts.properties 28B
WebRoot
WEB-INF
applicationContext.xml 563B
classes
struts.xml 825B
com
zx
test
view
struts2
action
ClientsAction.class 5KB
servlet
RandomCodeServlet.class 3KB
model
service
ClientService.class 269B
spring
ClientServiceImp.class 4KB
entity
Client.class 2KB
util
maps
Client.xml 961B
SqlMapConfig.xml 1KB
struts.properties 28B
lib
web.xml 2KB
failure.html 545B
regist.jsp 4KB
index.jsp 1KB
images
META-INF
MANIFEST.MF 39B
clientsList.jsp 3KB
success.html 545B
.myeclipse
.settings
com.genuitec.eclipse.j2eedt.core.prefs 1KB
.classpath 2KB
SSI.jar
oro-2.0.8.jar 64KB
ognl-2.6.11.jar 164KB
spring.jar 2.56MB
xwork-2.0.1.jar 442KB
ibatis-dao-2.jar 59KB
commons-pool.jar 61KB
spring-mock.jar 102KB
antlr-2.7.2.jar 350KB
commons-validator-1.3.0.jar 117KB
commons-beanutils-1.6.jar 116KB
commons-dbcp.jar 105KB
ibatis-common-2.jar 83KB
classes12.jar 1.52MB
struts2-spring-plugin-2.0.6.jar 8KB
commons-chain-1.1.jar 88KB
struts2-core-2.0.6.jar 2.09MB
commons-logging.jar 37KB
ibatis-sqlmap-2.jar 298KB
commons-fileupload-1.2.1.jar 56KB
commons-io-1.4.jar 106KB
commons-logging-api-1.1.jar 44KB
spring-aspects.jar 11KB
freemarker-2.3.8.jar 784KB
共 55 条
- 1
庞门左道
- 粉丝: 5
- 资源: 49
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页