request.setAttribute("timeSheet_ID", timeSheet_ID);
request.setAttribute("employee_id", employee_id);
request.setAttribute("Assignment_ids", Assignment_ids);
request.setAttribute("task_names", task_names);
request.setAttribute("Dates", Dates);
request.setAttribute("durations", durations);
request.setAttribute("project_names", project_names);
我的servlet有一个上面的代码。每个request.setAttribute都有一组n个值。
<td>${employee_id}</td>
<td>${timeSheet_ID}</td>
<td>${Assignment_ids}</td>
<td>${task_names}</td>
<td>${Dates}</td>
<td>${durations}</td>
<td>${project_names}</td>
在我的jsp页面中,我有一个上面的代码来显示request.setAttribute中的那些值。它显示为值
[71, 71, 71, 71, 71] [56, 57, 58, 59, 60] [2, 2, 2, 2, 2] [View Task, View Task, View Task, View Task, View Task] [2013-09-30, 2013-10-01, 2013-10-02, 2013-10-03, 2013-10-04] [15, 12, 15, 15, 15] [Timesheet Application, Timesheet Application, Timesheet Application, Timesheet Application, Timesheet Application]
但我需要将值显示为表格格式 例如,
71 56 2 View Task 2013-09-30 2 Timesheet Appli
71 57 2 View Task 2013-09-30 3 Timesheet Appli
71 58 2 View Task 2013-09-30 5 Timesheet Appli
71 59 2 View Task 2013-09-30 5 Timesheet Appl
71 60 2 View Task 2013-09-30 4 Timesheet Appli
我只是尝试使用“c:forEach”。但我没有垂直显示。
答案 0 :(得分:1)
<table>
<c:forEach ... >
<c:set var="count" value="0"/>
<tr>
<td>${employee_id[count]}</td>
<td>${timeSheet_ID[count]}</td>
<td>${Assignment_ids[count]}</td>
<td>${task_names[count]}</td>
<td>${Dates[count]}</td>
<td>${durations[count]}</td>
<td>${project_names[count]}</td>
<%=count++%>
</tr>
</c:forEach>
<table>