我通过从Java servlet作为对象获取Oracle的数据,在jsp中动态创建表。我的目标是通过将行num的值发送到另一个java servlet来编辑行。虽然我试图在下面的例子中打印alert的值,但它只恢复行中的最后一个值。谢谢你的帮助!
代码段& JavaScript的。目标是将crObject.getRefNum()的值发送到java servlet。这是在jsp
中完成的<div class="container">
<table class="table">
<th>Ref #</th>
<th>CR #</th>
<th>Imapcted Application</th>
<th>Deployment Starts</th>
<th>Deployment Ends</th>
<th>Issue Description</th>
<th>Approval Status</th>
<th>Edit</th>
<%
CRDetails crObject;
for (int i = 0; i < listLength; i++)
{
crObject = (CRDetails) Alldata.get(i);
out.println("<tr><td>" + crObject.getRefNum() + "</td>" + "\n");
out.println("<td>" + crObject.getCrNum() + "</td>" + "\n");
out.println("<td>" + crObject.getAppName() + "</td>" + "\n");
out.println("<td>" + crObject.getDeployStartTime() + "</td>" + "\n");
out.println("<td>" + crObject.getDeployEndTime() + "</td>" + "\n");
out.println("<td>" + crObject.getIssueDesc() + "</td>" + "\n");
out.println("<td>" + crObject.getStatus() + "</td>" + "\n");
pageContext.setAttribute("refNum",crObject.getRefNum());
// pageContext.setAttribute("refNum",11);
%>
<td><a editid="<%=crObject.getRefNum()%>" href="javascript:editRow()" target="_blank">Edit</a>${crObject.getRefNum()}</td>
<!--<c:out value = '${refNum}' />-->
<%
}
%>