OUTPUT and EXPECTED OUTPUT in the below-Attached image:
https://i.stack.imgur.com/LT9kQ.png
Here the code is working, But my expected output is I want to merge the PDF as one link(whereas it gets repeated for all rows) for one DEPT, as mentioned in the Attached output image.
Based on the Department, there may be a difference in the subject.say one dept may have 4 subjects another department may have 6 subjects.BUT in the REPORT ROW, there shouldn't be PDF links for all the rows. It should be merged as one link for each department.
Since it is dynamic unable to use the row span for the REPORT row, I couldn't get the proper solution. Can someone pls guide in this?
<table id="DataTable" class="table table-striped table-bordered table-responsive table-hover" cellspacing="0" width="100%" height="300px"
<tr style="color:white; background-color:#206aae;">
<th>ID</th>
<th>NAME</th>
<th>DEPT</th>
<th>SUBJECT</th>
<th>REPORTS</th>
</tr>
<tbody>
<%
//connecting db
ResultSet rs = statement.executeQuery(selectQuery);
while(rs.next())
{
String ID = rs.getString("ID");
String NAME = rs.getString("NAME");
String DEPT = rs.getString("DEPT");
String SUBJECT = rs.getString("SUBJECT");
String REPORTS = rs.getString("REPORTS");
%>
<tr>
<td><%=id%></td>
<td><%=name%></td>
<td><%=dept%></td>
<td><%=subject%></td>
<td><%=reports%></td>
<td>
<%
String pdfpath = path+"\\"+currentDateFolder+"\\Report_"+id+"_"+name+".pdf";
String filePDF_pathtodownload = "..\\upload\\"+currentDateFolder+"\\Report_"+id+"_"+name+".pdf";
String filename = "Report_"+id+"_"+name+".pdf";
%>
<a href="file_pdfileDownload.jsp?currentDateFolder=<%=currentDateFolder%>&name=<%=name%>&filename=<%=filename%>&id=<%=id%>">PDF</a>
<%
%>
</td>
</tr>
<%
}
rs.close();
statement.close();
connection.close();
%>
</tbody>
</table>