基于Struts1.2的动态多文件上传
时间:2011-08-05
首先是web.xml配置
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
然后是struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<data-sources />
<form-beans >
<form-bean name="multiUploadForm" type="com.hb.struts.form.MultiUploadForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="multiUploadForm"
name="multiUploadForm"
path="/multiUpload"
scope="request"
type="com.hb.struts.action.MultiUploadAction"
validate="false" />
</action-mappings>
<message-resources parameter="com.hb.struts.ApplicationResources" />
</struts-config>
基于Struts1.2的动态多文件上传(2)
时间:2011-08-05
然后是页面test.jsp,这段就是网上COPY的动态生成页面
<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html>
<head>
<title>
multiUploadDemo
</title>
<script language="javascript">
var num = 0;
function upload
|