• 大小: 3.87MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-11
  • 语言: 数据库
  • 标签:

资源简介

很实用的一个利用struts2结合ssh2框架实现文件上传的例子,把工程导入myeclipce就可以运行,最大支持2G的文件上传,数据库使用mysql,建库语句在工程里面有,分享给大家

资源截图

代码片段和文件信息

package filter;

import java.io.IOException;
import java.util.Map;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.opensymphony.xwork2.ActionContext;

import ssh2Down.service.UserService;

public class EncodingFilter implements Filter{

public void destroy() {
// TODO 自动生成方法存根

}



public void init(FilterConfig arg0) throws ServletException {
// TODO 自动生成方法存根

}



public void doFilter(ServletRequest arg0 ServletResponse arg1 FilterChain arg2) throws IOException ServletException {
// TODO 自动生成方法存根
HttpServletRequest request=(HttpServletRequest) arg0;
HttpSession session=request.getSession();
// Map session=ActionContext.getContext().getSession();
if
(session.getAttribute(“userService.USER_NAME“)!=null)
// (session.get(“userService.USER_NAME“)!=null)
{
request.setCharacterEncoding(“GBK“);
arg2.doFilter(request arg1);
}else{
String requestUrl=request.getRequestURI();
if(requestUrl.endsWith(“/login.jsp“) || requestUrl.endsWith(“/register.jsp“) || requestUrl.endsWith(“userLogin.action“) || requestUrl.endsWith(“userRegister.action“))
{
request.setCharacterEncoding(“GBK“);
arg2.doFilter(request arg1);
}else{

((HttpServletResponse)arg1).sendRedirect(“login.jsp“);

}

}

}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\
     文件        1888  2008-10-27 13:51  ssh2文件上传和下载实例\ssh2Down\.classpath
     目录           0  2008-10-27 13:45  ssh2文件上传和下载实例\ssh2Down\.myeclipse\
     文件         529  2008-10-29 16:12  ssh2文件上传和下载实例\ssh2Down\.myhibernatedata
     文件         297  2008-10-27 13:45  ssh2文件上传和下载实例\ssh2Down\.mymetadata
     文件        1636  2008-10-27 14:49  ssh2文件上传和下载实例\ssh2Down\.project
     文件         479  2008-10-27 13:51  ssh2文件上传和下载实例\ssh2Down\.springBeans
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\src\
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\src\filter\
     文件        1668  2008-10-28 19:48  ssh2文件上传和下载实例\ssh2Down\src\filter\EncodingFilter.java
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\action\
     文件        5088  2008-10-28 18:26  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\action\FileAction.java
     文件        2043  2008-10-29 14:44  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\action\UserAction.java
     文件        4165  2008-10-29 19:17  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\action\WebAction.java
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\
     文件        1577  2008-10-29 16:15  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Downfile.hbm.xml
     文件        2222  2008-10-29 16:12  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Downfile.java
     文件        5126  2008-10-29 16:13  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\DownfileDAO.java
     文件        1001  2008-10-29 16:24  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Downrecord.hbm.xml
     文件        1310  2008-10-29 16:12  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Downrecord.java
     文件        4185  2008-10-29 16:12  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\DownrecordDAO.java
     文件        1574  2008-10-29 16:23  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Users.hbm.xml
     文件        2114  2008-10-29 16:12  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Users.java
     文件        4487  2008-10-29 16:12  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\UsersDAO.java
     文件        1358  2008-10-29 16:15  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Webdisk.hbm.xml
     文件        1912  2008-10-29 16:12  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\Webdisk.java
     文件        5076  2008-10-29 16:14  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\dao\WebdiskDAO.java
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\service\
     目录           0  2013-10-17 11:23  ssh2文件上传和下载实例\ssh2Down\src\ssh2Down\serviceImpl\
............此处省略68个文件信息

评论

共有 条评论

相关资源