惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
The GitHub Blog
The GitHub Blog
腾讯CDC
GbyAI
GbyAI
宝玉的分享
宝玉的分享
The Register - Security
The Register - Security
B
Blog RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
AWS News Blog
AWS News Blog
S
Schneier on Security
P
Proofpoint News Feed
C
Check Point Blog
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Last Week in AI
Last Week in AI
NISL@THU
NISL@THU
H
Hacker News: Front Page
Blog — PlanetScale
Blog — PlanetScale
T
The Exploit Database - CXSecurity.com
S
Security Affairs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
T
Tenable Blog
C
CERT Recently Published Vulnerability Notes
Security Latest
Security Latest
C
Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
Google DeepMind News
Google DeepMind News
F
Full Disclosure
L
LINUX DO - 热门话题
博客园 - Franky
K
Kaspersky official blog
C
Cyber Attacks, Cyber Crime and Cyber Security
U
Unit 42
Recorded Future
Recorded Future
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
Project Zero
Project Zero
F
Fortinet All Blogs
O
OpenAI News
Recent Announcements
Recent Announcements

博客园 - 摆渡人 外婆桥!

此BLOG不再继续了,请访问http://www.blogjava.net/swingboat 在Oracle中,快速获取一个部门以及它下面所有的子部门的方法。 cache模式的两种构成方式 OsWorkFlow学习(FSM:有限状态机) OsWorkFlow学习(概念) OsWorkFlow学习(数据库设置) 知识 企业如何确定是否需要BPM(出自:计世网) jsp页面,以excel的方式输出 - 摆渡人 外婆桥! - 博客园 在jboss4环境下,URL查询参数中支持中文 - 摆渡人 外婆桥! - 博客园 使用Junit时源代码和测试代码的组织(摘自Daping_Zhang 的 Blog ) junit的使用 利用html中的div标签实现网页中某一块区域的自动滚动 struts及jstl使用问题集(一) 在struts框架下实现文件的上传 利用jspsmartupload上传文件,当我不选择文件就直接上传,会有什么结果呢?一个字“惨”啊! 软件工程中的经典案例! 利用edtftpj组件实现FTP文件的上传。 含有中文字符串的截取问题!
在struts1.1框架下,利用smartupload实现文件的上传(可以是多个文件)
摆渡人 外婆桥! · 2005-05-25 · via 博客园 - 摆渡人 外婆桥!

1、前端页面upload.jsp,后台处理程序UplodAction.java
2、struts.config的配置参数如下(没有设置ActionForm):
<action input="/upload.jsp"  path="/save" scope="request" type="yhp.test.web.UploadAction" validate="false">
      <forward name="success" path="/list.do" />
    </action>
3、upload.jsp页面中主要部分代码
<%@ page contentType="text/html; charset=GBK"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html:html>
<head>
<title> 测试Struts利用SmartUpload上传文件 </title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
</head>
<body>
<html:form action="/save.do" styleId="formItem" method="post"  enctype="multipart/form-data">
<html:hidden property="id"/>
<html:file property="serverpath" styleClass="input-text"></html:file>
</html:form>
</body>
</html:html>
4、UploadAction.java
import com.jspsmart.upload.File;
import com.jspsmart.upload.Files;
import com.jspsmart.upload.SmartUpload;

public ActionForward doBatchsave(ActionMapping actionMapping,
   ActionForm actionForm, HttpServletRequest httpServletRequest,
   HttpServletResponse httpServletResponse) throws Exception {
SmartUpload mySmartUpload = new SmartUpload();
  mySmartUpload.initialize(getServlet().getServletConfig(),httpServletRequest, httpServletResponse);  
  mySmartUpload.upload();
  //获取除文件以外的相关信息,例如upload.jsp中隐藏控件id的值
  String strId=(String)mySmartUpload.getRequest().getParameter("id");
  Files files=mySmartUpload.getFiles();
  Collection col=files.getCollection();
  Iterator it=col.iterator();
  while(it.hasNext()){
    File file=(File)it.next();    
    String oldFileName=file.getFileName();     
    String extname=file.getFileExt();
    String fileName=Sequence.getSequence()+"."+extname;//产生一个唯一的文件名
    file.saveAs("c:\\temp\"+fileName);    
  }
  return (actionMapping.findForward("success"));