请见如下代码举例:
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<base href="<%=basePath%>">
<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="${pageContext.request.contextPath}/css/jquery-ui-1.9.2.custom.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/kindeditor.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-ui-1.9.2.custom.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.ui.datepicker-zh-CN.js" ></script>
<script type="text/javascript">
$(function(){
//点击"删除"按钮时,异步修改时间和删除
$(".closeButton").live("click",function(){
//获取当前td的行位置
var row=$(this).parent().prevAll().length;
//获取当前td的列位置
var col=$(this).prevAll().length;
//获取所有的input值
/*第一种方法,遍历所有input的值
jQuery('tr td input').each(function(){
alert(jQuery(this).val());
});
*/
var allKssj=document.getElementById("fqsjTable").getElementsByTagName("input");
//获取当前输入时间,截取格式:“2016-02-02 16:22:00”
var nowInput=allKssj[row].value.substring(0,19);

/*遍历所有的input
for(var i=0;i<allKssj.length;i++)
{
if(allKssj[i].type=='text')
{
alert(i);
alert(allKssj[i].value);
}
}*///获取当前选择的门店号和id
var hdbh=$(this).prev().prev().prev().text();
var id=$(this).prev().prev().prev().prev().text();
alert(nowInput);
//alert(kssj);
// alert(hdbh);
//alert(id);
});
//日期插件
$(".kssjTime").datepicker({
dateFormat:'yy-mm-dd'+' 06:00:00'
});//异步添加时间
function getDate(){
var time2="<c:out value='${requestScope.ooc.kssj}'/>";
if(time2==""){
$.ajax({
type:"post",
contentType:"application/x-www-form-urlencoded;charset=GBK",//这句很重要,如果没有这行代码,则只有在火狐中可以使用;
url:"${pageContext.request.contextPath}/common/getDate",
success:function(ret){
$("#time").val(ret);
},
dataType:"JSON"
});
}
}
</script>
</head>

<body onLoad="getDate();">
<c:if test="${not empty requestScope._testMdPage.fqsjList}">
<table id="fqsjTable" border="1" cellpadding="0" cellspacing="0" style="padding: 2px;" width="100%;">
<tr>
<td colspan="9" align="center"><font size="4" color="blue" ><strong>活动发券时间段</strong></font></td>
</tr>
<tr>
<td><strong>最大发放量</strong></td>
<td><strong>剩余数量</strong></td>
<td><strong>结束时间</strong></td>
<td><strong>生成时间</strong></td>
<td><strong>发券时间id</strong></td>
<td><strong>活动编号</strong></td>
<td><strong>是否有效</strong></td>
<td><strong>开始时间</strong></td>
<td align="center"><font color="blue"><strong>操作</strong></font></td>
</tr>
<c:forEach items="${requestScope._testMdPage.fqsjList}" var="p">
<tr>
<td><c:out value="${p.ffsl}"/></td>
<td><c:out value="${p.sysl}"/></td>
<td><c:out value="${p.jssj}"/></td>
<td><c:out value="${p.scsj}"/></td>
<td><c:out value="${p.id}"/></td>
<td><c:out value="${p.hdbh}"/></td>
<td><c:out value="${p.sfyx}"/></td>
<td><INPUT type="text" class="kssjTime" value="<c:out value='${p.kssj}'/>" /></td>
<td align="center" class="closeButton"><button>关闭测试</button></td>
</tr>
</c:forEach>
</table>
</c:if>
<br/>
</body>
</html>