다른 테이블에서 주문 데이터를로드하려고합니다.
JOIN
쿼리를 사용하여 테이블의 데이터도 표시했습니다 .
이것은 내 O / P입니다 :
나는 다음과 같은 것을 원한다.
주문 ID, 즉 번호가 반복되는 경우 한 번 표시되어야합니다.
내 JSP 코드 :
<table class="table table-condensed">
<%
List<String> oIdList = (List<String>)request.getAttribute("oIdList");
List<String> pNameList = (List<String>)request.getAttribute("pNameList");
List<String> pQtyList = (List<String>)request.getAttribute("pQtyList");
List<String> pTimeList = (List<String>)request.getAttribute("pTimeList");
List<Boolean> pStatusList = (List<Boolean>)request.getAttribute("statusList");
%>
<thead>
<tr>
<th width="8%">No.</th>
<th width="23%">Product Name</th>
<th width="20%">Product Qty</th>
<th width="18%">Order Time</th>
<th width="22%"><div align="center">Order Status</div></th>
</tr>
</thead>
<tbody>
<%
for(int i = 0; i<pNameList.size(); i++)
{
%>
<tr>
<td><%= oIdList.get(i) %></td>
<td class="center"><%= pNameList.get(i) %></td>
<td class="center"><%= pQtyList.get(i) %></td>
<td class="center"><%= pTimeList.get(i) %></td>
<%
if(pStatusList.get(i))
{
%>
<td class="center"><div align="center"><span class="label label-success">Delivered</span></div></td>
<%
}
else
{
%>
<td style="text-align: center;" width="9%"><span class="label">Pending</span></td>
<%
}
%>
</tr>
<%
}
%>
</tbody>
</table>
그래서 어떤 제안을 해주세요 ..
안녕하세요. 동료. 이 시도
for(int j =0,i = 0; i<pNameList.size(); i++) {
%> <tr> <%
if(i==0){
j++;
%> <td><%= j %></td> <%
}else if(oIdList.get(i) != oIdList.get(i-1)){
j++;
%> <td><%= j %></td> <%
}else{
%> <td></td> <%
}
%>
<td class="center"><%= pNameList.get(i) %></td>
<td class="center"><%= pQtyList.get(i) %></td>
<td class="center"><%= pTimeList.get(i) %></td>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다