Repository navigation
Expand file tree
/
Copy pathInsertThings.jsp
More file actions
93 lines (79 loc) · 2.3 KB
/
Copy pathInsertThings.jsp
File metadata and controls
93 lines (79 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Insert page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<div style="text-align:center;">
<h3>新增</h3>
</div>
<font color="red"><s:fielderror/></font>
<s:form action="insertThings" theme="simple" enctype="multipart/form-data">
<table align="center" border="1">
<tr>
<td>商品名称:</td>
<td><s:textfield name="name"></s:textfield>
<td><s:fielderror fieldName="name"/></td>
</td>
</tr>
<tr>
<tr>
<td>商品价格:</td>
<td><s:textfield name="price" onkeyup="this.value=this.value.replace(/[^0-9.]+/,'');" ></s:textfield>
</td>
</tr>
<tr>
<td>商品描述:</td>
<td><s:textarea name="description" cssStyle="size:10px; width:160px;height:60px"></s:textarea>
</td>
</tr>
<tr>
<td>商品图片:</td>
<td id="more"><s:file name="file"></s:file> <input
type="button" value="Add More.." onclick="addMore()"></td>
</tr>
<tr>
<td></td>
<td><s:submit value=" submit "></s:submit> <s:reset
value=" reset "></s:reset></td>
</tr>
</table>
</s:form>
</body>
<script type="text/javascript">
function addMore() {
var td = document.getElementById("more");
var br = document.createElement("br");
var input = document.createElement("input");
var button = document.createElement("input");
input.type = "file";
input.name = "file";
button.type = "button";
button.value = "Remove";
button.onclick = function() {
td.removeChild(br);
td.removeChild(input);
td.removeChild(button);
}
td.appendChild(br);
td.appendChild(input);
td.appendChild(button);
}
</script>
</body>
</html>