多图片上传(struts实现)
2009-09-22 00:00:00 来源:WEB开发网index.jsp
<%@ page language="java" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>struts upload by zhangc</title>
</head>
<body>
<a href="new.jsp">create</a><br>
</body>
</html>
new.jsp
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<html>
<head>
<title>struts upload by zhangc</title>
<script language="javascript">
var rnum = 1;
function addRow()
{
var oT = document.getElementById("oTable");
var newTR = oT.insertRow(oT.rows.length-1);
newTR.id = "row" + rnum;
var newTD0 = newTR.insertCell();
var newTD1 = newTR.insertCell();
newTD1.setAttribute("colSpan","2");
newTD0.innerText = "file:";
newTD1.innerHTML = "<input name=\"file"
+ rnum
+ "\" type=\"file\" > <input name=\"del\" type=\"button\" value=\"删除 \" onClick=\"deleteRow(" + rnum +");\">";
rnum++;
}
function deleteRow(line)
{
oTable.deleteRow(document.getElementById("row" + line).rowIndex);
}
</script>
</head>
<body>
<form name="updForm" method="post" action="upload.do" enctype="multipart/form-data">
<table id="oTable">
<tr>
<td>name:</td>
<td><input name="name" type="text"></td>
</tr>
<tr>
<td>上传图片:</td>
<td><input type=file name="temp"> <input type="button" name="add" value="多图片上传 " ></td>
</tr>
<tr>
<td><input name="sub" type="submit" value=" 上传 "></td>
</tr>
</table>
</form>
</body>
</html>
更多精彩
赞助商链接