package org.action;
import java.io.File;
import java.io.FileInputStream;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import org.model.Xsb;
import org.service.XsService;
import org.service.ZyService;
import org.tool.Pager;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class XsAction extends ActionSupport{
private int pageNow=1;
private int pageSize=8;
private File zpfile;
//存放专业集合
private List list;
public void setList(List list) {
this.list = list;
}
public List getList(){
return zyService.getAll();//返回专业集合
}
public File getZpfile() {
return zpfile;
}
public void setZpfile(File zpfile) {
this.zpfile = zpfile;
}
private Xsb xs;
private XsService xsService;
private ZyService zyService;
public void setZyService(ZyService zyService) {
this.zyService = zyService;
}
public int getPageNow() {
return pageNow;
}
public void setPageNow(int pageNow) {
this.pageNow = pageNow;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String execute() throws Exception {
System.out.println(this.getPageNow());
List list=xsService.findAll(pageNow,pageSize);
Map request=(Map)ActionContext.getContext().get("request");
Pager page=new Pager(getPageNow(),xsService.findXsSize());
request.put("list", list);
request.put("page", page);
return SUCCESS;
}
public String addXs() throws Exception{
Xsb stu=new Xsb();
String xh1=xs.getXh();
if(xsService.find(xh1)!=null){
return ERROR;
}
stu.setXh(xs.getXh());
stu.setXm(xs.getXm());
stu.setXb(xs.getXb());
stu.setCssj(xs.getCssj());
System.out.println(xs.getCssj());
stu.setZxf(xs.getZxf());
stu.setBz(xs.getBz());
stu.setZyb(zyService.getOneZy(xs.getZyb().getId()));
if(this.getZpfile()!=null){
FileInputStream fis=new FileInputStream(this.getZpfile());
byte[] buffer=new byte[fis.available()];
fis.read(buffer);
stu.setZp(buffer);
}
xsService.save(stu);
return SUCCESS;
}
public String deleteXs() throws Exception{
String xh=xs.getXh();
xsService.delete(xh);
return SUCCESS;
}
public String updateXsView()throws Exception{
String xh=xs.getXh();
Xsb xsInfo=xsService.find(xh);
List zys=zyService.getAll();
Map request=(Map)ActionContext.getContext().get("request");
request.put("xsInfo", xsInfo);
request.put("zys", zys);
return SUCCESS;
}
public String updateXs()throws Exception{
Xsb xs1=xsService.find(xs.getXh());
xs1.setXm(xs.getXm());
xs1.setXb(xs.getXb());
xs1.setZyb(zyService.getOneZy(xs.getZyb().getId()));
xs1.setCssj(xs.getCssj());
xs1.setZxf(xs.getZxf());
xs1.setBz(xs.getBz());
if(this.getZpfile()!=null){
FileInputStream fis=new FileInputStream(this.getZpfile());
byte[] buffer=new byte[fis.available()];
fis.read(buffer);
xs1.setZp(buffer);
}
Map request=(Map)ActionContext.getContext().get("request");
xsService.update(xs1);
return SUCCESS;
}
public String getImage() throws Exception{
HttpServletResponse response = ServletActionContext.getResponse();
String xh=xs.getXh();
Xsb xs3=xsService.find(xh);
byte[] img = xs3.getZp();
response.setContentType("image/jpeg");
ServletOutputStream os = response.getOutputStream();
if ( img != null && img.length != 0 )
{
for (int i = 0; i < img.length; i++)
{
os.write(img[i]);
}
os.flush();
}
return NONE;
}
public String findXs()throws Exception{
String xh=xs.getXh();
Xsb stu2=xsService.find(xh);
Map request=(Map)ActionContext.getContext().get("request");
request.put("xs", stu2);
return SUCCESS;
}
public String addXsView()throws Exception{
return SUCCESS;
}
public Xsb getXs() {
return xs;
}
public void setXs(Xsb xs) {
this.xs = xs;
}
public XsService getXsService() {
return xsService;
}
public void setXsService(XsService xsService) {
this.xsService = xsService;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
javaee Struts2+Hibernate+Spring学生成绩管理系统
共214个文件
jar:78个
class:32个
java:32个
4星 · 超过85%的资源 需积分: 10 142 下载量 108 浏览量
2015-10-30
11:26:13
上传
评论 5
收藏 21.05MB RAR 举报
温馨提示
javaee Struts2+Hibernate+Spring学生成绩管理系统
资源推荐
资源详情
资源评论
收起资源包目录
javaee Struts2+Hibernate+Spring学生成绩管理系统 (214个子文件)
XsAction.class 6KB
CjAction.class 4KB
KcAction.class 4KB
CjDaoImp.class 3KB
XsDaoImp.class 3KB
KcDaoImp.class 2KB
Xsb.class 2KB
Pager.class 2KB
CjServiceManage.class 2KB
Kcb.class 1KB
DlAction.class 1KB
DlDaoImp.class 1KB
CjbId.class 1KB
KcServiceManage.class 1KB
XsServiceManage.class 1KB
Zyb.class 1KB
Cjb.class 1KB
ZyDaoImp.class 1KB
Dlb.class 1KB
MyFilter.class 1KB
DlServiceManage.class 959B
ZyServiceManage.class 880B
CjService.class 519B
CjDao.class 507B
KcService.class 326B
XsService.class 326B
XsDao.class 314B
KcDao.class 314B
DlService.class 260B
DlDao.class 248B
ZyService.class 225B
ZyDao.class 213B
.classpath 7KB
org.eclipse.wst.common.component 556B
org.eclipse.wst.jsdt.ui.superType.container 49B
head.gif 64KB
foot.gif 38KB
bottom.gif 2KB
xsInfo.gif 2KB
cjInfo.gif 1KB
findCj.gif 1KB
findKc.gif 1KB
addXs.gif 1KB
addCj.gif 1KB
addKc.gif 1KB
findXs.gif 1KB
kcInfo.gif 1KB
spring.jar 2.47MB
struts2-core-2.0.11.jar 2.22MB
hibernate3.jar 1.87MB
jgroups-2.2.8.jar 1.53MB
jsf-impl.jar 1.19MB
freemarker-2.3.8.jar 784KB
jboss-jmx.jar 578KB
jboss-common.jar 573KB
commons-collections.jar 558KB
struts.jar 537KB
mysql-connector-java-5.0.8-bin.jar 528KB
dwr.jar 2.0.jar 489KB
c3p0-0.9.0.jar 477KB
proxool-0.8.3.jar 459KB
xwork-2.0.4.jar 445KB
antlr-2.7.6rc1.jar 427KB
jstl-1.2.jar 426KB
spring-beans.jar 398KB
standard.jar 384KB
log4j-1.2.14.jar 377KB
jboss-cache.jar 364KB
log4j-1.2.11.jar 343KB
mail.jar 339KB
jsf-api.jar 327KB
dom4j-1.6.1.jar 303KB
cglib-2.1.3.jar 276KB
cglib-2.2_beta1.jar 275KB
commons-httpclient.jar 273KB
commons-lang.jar 237KB
spring-jdbc.jar 236KB
sqljdbc.jar 227KB
jaxen-1.1-beta-7.jar 223KB
jboss-system.jar 218KB
spring-core.jar 187KB
commons-beanutils.jar 184KB
commons-collections-2.1.1.jar 170KB
spring-context.jar 168KB
concurrent-1.3.2.jar 166KB
commons-digester.jar 164KB
ognl-2.6.11.jar 164KB
spring-dao.jar 137KB
junit.jar 127KB
xml-apis.jar 121KB
oscache-2.1.jar 112KB
spring-hibernate3.jar 111KB
commons-dbcp.jar 105KB
spring-jpa.jar 103KB
jaas.jar 101KB
commons-javaflow.jar 94KB
servlet-api.jar 90KB
commons-validator.jar 82KB
persistence.jar 78KB
commons-discovery.jar 70KB
共 214 条
- 1
- 2
- 3
资源评论
- qq_406994242018-06-14没有数据库???
- fytfyt12018-05-09很好的学习资料,有很大帮助。
qq_15122069
- 粉丝: 1
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功