<html>
<head>
<meta charset="UTF-8">
<title>
window.navigator
</title>
<style>
td {
border: 1px solid gray
padding: 3px 5px
}
</style>
<script>
onload = function(){
var tab = document.getElementsByTagName("table")[0]
var rows = tab.rows
var th = document.createElement("th")
th.innerHTML = "选择"
rows[0].insertBefore(th,rows[0].cells[0])
for(var i = 1 i < rows.length i++){
var td = rows[i].insertCell(0)
var ck = document.createElement("input")
ck.type = "checkbox"
td.appendChild(ck)
}
}
</script>
</head>
<body>
<table>
<tr>
<th>
数量
</th>
<th>
原价
</th>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
</body>
</html>
该Action实现RequestAware,页面上的所有input的name属性都写成journey然后直接用String[] strs = request.getParameterValues(“journey”)吧,底下是其API说明。getParameterValues(String name)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
Struts2本身是不支持传递数组的。所以有人使用各种分隔符传递字符串来代替
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)