• 大小: 37.71MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-05
  • 语言: Java
  • 标签: java  ssh框架  

资源简介

适用于java初学者理解ssh框架,使用Oracle数据库,结合jQuery的ajax技术,实现单表增删改查、条件查询和分页、文件上传

资源截图

代码片段和文件信息

package cn.bdqn.ssh.action;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.commons.io.FileUtils;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

import cn.bdqn.ssh.constrant.Const;
import cn.bdqn.ssh.entity.Standard;
import cn.bdqn.ssh.service.StandardService;
import cn.bdqn.ssh.util.PageBean;
import net.sf.json.JSONobject;

public class StandardAction extends ActionSupport {

private static final long serialVersionUID = 1L;

private StandardService standardService;
//JavaBean形式接收响应的数据
private Standard standard;
//查询条件
private String queryCondition;
//查询结果
private PageBean standards;
//当前页面
private int pageIndex=1;
//标准号
private String stdNum;
private String result;
//文件上传
private File pic;
private String picContentType;
private String picFileName;
//修改标准号Id
private String stdId;

public void setStandardService(StandardService standardService) {
this.standardService = standardService;
}

public Standard getStandard() {
return standard;
}

public void setStandard(Standard standard) {
this.standard = standard;
}

public PageBean getStandards() {
return standards;
}

public void setStandards(PageBean standards) {
this.standards = standards;
}

public int getPageIndex() {
return pageIndex;
}

public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}

public String getQueryCondition() {
return queryCondition;
}

public void setQueryCondition(String queryCondition) {
this.queryCondition = queryCondition;
}

public String getStdNum() {
return stdNum;
}

public void setStdNum(String stdNum) {
this.stdNum = stdNum;
}

public String getResult() {
return result;
}

public void setResult(String result) {
this.result = result;
}

public File getPic() {
return pic;
}

public void setPic(File pic) {
this.pic = pic;
}

public String getPicContentType() {
return picContentType;
}

public void setPicContentType(String picContentType) {
this.picContentType = picContentType;
}

public String getPicFileName() {
return picFileName;
}

public void setPicFileName(String picFileName) {
this.picFileName = picFileName;
}

public String getStdId() {
return stdId;
}

public void setStdId(String stdId) {
this.stdId = stdId;
}

public String saveStandard() {
//文件上传
try {
String rootPath=ServletActionContext.getServletContext().getRealPath(File.separator);
String fileEx=picFileName.substring(picFileName.lastIndexOf(“.“)picFileName.length());
String fileName=System.currentTimeMillis()+fileEx;
File destFile=new File(rootPath+File.separatorChar+Const.UPLOAD_PATH+File.separatorChar+fileName);
FileUtils.copyFile(pic destFile);
standard.setPackagePath(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-29 12:16  ssh\
     文件         771  2018-04-26 08:36  ssh\.classpath
     文件         903  2018-03-28 08:42  ssh\.project
     目录           0  2018-03-29 12:16  ssh\.settings\
     文件         567  2018-03-28 08:42  ssh\.settings\.jsdtscope
     文件          69  2018-03-29 11:10  ssh\.settings\org.eclipse.core.resources.prefs
     文件         364  2018-03-28 08:42  ssh\.settings\org.eclipse.jdt.core.prefs
     文件         461  2018-03-28 08:42  ssh\.settings\org.eclipse.wst.common.component
     文件         345  2018-03-28 08:42  ssh\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2018-03-28 08:42  ssh\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2018-03-28 08:42  ssh\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2018-03-29 12:16  ssh\build\
     目录           0  2018-05-02 07:56  ssh\build\classes\
     文件        3434  2018-04-17 22:06  ssh\build\classes\applicationContext.xml
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\action\
     文件        6798  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\action\StandardAction.class
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\constrant\
     文件         400  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\constrant\Const.class
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\dao\
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\dao\impl\
     文件        3715  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\dao\impl\StandardDaoImpl.class
     文件         617  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\dao\StandardDao.class
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\entity\
     文件        2105  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\entity\Standard.class
     文件        1269  2018-04-08 18:17  ssh\build\classes\cn\bdqn\ssh\entity\Standard.hbm.xml
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\service\
     目录           0  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\service\impl\
     文件        3173  2018-05-02 07:56  ssh\build\classes\cn\bdqn\ssh\service\impl\StandardServiceImpl.class
............此处省略91个文件信息

评论

共有 条评论