我正在尝试将文本值传递给另一个jsp页面,并且所有元素都是动态创建的。即使名称已正确分配,我也无法在其他页面中接收这些值。请帮我找出错误。提前致谢!!! 这是第一页。
<%!
int wellname_counter = 0 ;
%>
<sql:query dataSource="${snapshot}" var="result">
SELECT * FROM work_history WHERE from_date >= ? ;
<sql:param value="${from_date}"/>
</sql:query>
<center>
<table class="table-fill">
<thead>
<tr>
<th class="text-center">Select The Well</th>
<th class="text-center">Well No</th>
<th class="text-center">From Date</th>
<th class="text-center">To Date</th>
<th class="text-center">Job Done</th>
<th class="text-center">Rig</th>
</tr>
</thead>
<form action="Generate-Excel/work_history.jsp" method="POST">
<tbody class="table-hover">
<% wellname_counter = 0 ;%>
<c:forEach var="row" items="${result.rows}">
<tr>
<td class="text-center">
<input type="checkbox" name="name<%= wellname_counter %>" id="select_element" value="<%= wellname_counter %>">
</td>
<!-- For getting the name from well_sno attribute -->
<sql:query dataSource="${snapshot}" var="wellname">
SELECT name FROM well_name WHERE sno = ? ;
<sql:param value="${row.well_sno}"/>
</sql:query>
<td class="text-center">
<c:forEach var="only_wellname" items="${wellname.rows}">
<input type="text" value="<c:out value="${only_wellname.name}"/>" disabled="true" class="remove_border" name="well_name<%= wellname_counter%>">
</c:forEach>
</td>
<td class="text-center"><input type="text" value="<c:out value="${row.from_date}"/>" disabled="true" class="remove_border" name="fromdate<%=wellname_counter%>"></td>
<td class="text-center"><input type="text" value="<c:out value="${row.to_date}"/>" disabled="true" class="remove_border" name="todate<%=wellname_counter%>"></td>
<td class="text-center"><input type="text" value="<c:out value="${row.jobdone}"/>" disabled="true" class="remove_border" name="jobdone<%=wellname_counter%>"></td>
<td class="text-center"><input type="text" value="<c:out value="${row.rig}"/>" disabled="true" class="remove_border" name="rig<%=wellname_counter%>"></td>
</tr>
<%wellname_counter++ ; %>
</c:forEach>
</tbody>
</table>
<input type="hidden" value="<%= wellname_counter %>" name="work_instance">
<div>
<input type="submit" value="UPDATE" class="styling"/>
<input type="submit" value="GENERATE EXCEL SHEET" class="green"/>
</div>
</form>
</center>
out.print( request.getParameter("name0") ) ;
out.print( request.getParameter("fromdate0") ) ;
out.print( request.getParameter("todate0") ) ;
out.print( request.getParameter("jobdone0") ) ;
out.print( request.getParameter("rig0") ) ;
答案 0 :(得分:0)
其实我喜欢解决方案我不应该“禁用='真''而不是”只读“
<input type="text" value="<c:out value="${row.from_date}"/>" disabled="true" class="remove_border" name="fromdate<%=wellname_counter%>">
这是放置灵魂的正确方法
<input type="text" value='<c:out value="${row.from_date}"/>' class="remove_border" name="fromdate<%=wellname_counter%>" readonly>