技术开发 频道

用Struts上传多个文件的方法


IT168技术文档】 
      建立上传用的JSP文件 upload.jsp
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %> <html:html> <head> <title>用Struts上传文件</title> </head> <body> <html:form action="/uploadsAction" enctype="multipart/form-data"> <html:file property="theFile"/> <html:file property="theFile2"/> <html:submit/> </html:form> </body> </html:html>
     配置struts-config.xml文件
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-
//Apache Software Foundation//DTD Struts Configuration 1.1//EN
"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <data-sources /> <form-beans > <form-bean name="uploadsForm" type="com.cnehu.struts.form.UpLoadForm" /> </form-beans> <global-exceptions /> <global-forwards > </global-forwards> <action-mappings > <action name="uploadsForm" type="com.cnehu.struts.action.UpLoadAction"
path
="/uploadsAction"> <forward name="display" path="/display.jsp" /> </action> </action-mappings> </struts-config>
0
相关文章