无法在jsp中显示从dao获取的数据
可能的重复:
如何在jsp中显示从dao获取的数据 < /p>
hi我能够检索数据并在控制台上打印它,但我无法在 jsp 中打印数据,下面是
while(rs.next())
{
System.out.println(rs.getString(1) +" " + rs.getString(2)+ " "+rs.getString(3) +" " + rs.getString(4)+"<br>");
SearchProjVO projVO = new SearchProjVO();
projVO.setProjid(rs.getString(1));
projVO.setProjname(rs.getString(2));
projVO.setCost(rs.getString(3));
projVO.setManager(rs.getString(4));
ar.add(projVO);
}
jsp 中 dao 中的代码我按以下格式调用这些变量是正确的
<td class="td-highlighted-2">
<div align="left"><a href="UpdateProject.html">${resultList.projId}</a></div>
</td>
<td class="td-highlighted-2">
<div align="left">${resultList.projName}</div>
</td>
<td class="td-highlighted-2">
<div align="left">${resultList.cost}</div>
</td>
<td class="td-highlighted-2">
<div align="left">${resultList.manager}</div>
</td>
</tr>
</c:forEach>
Possible Duplicate:
how to display data obtained from dao in jsp
hi i able to retrieve the data and print it on the console but i am unable to print the data in jsp below is the code in dao
while(rs.next())
{
System.out.println(rs.getString(1) +" " + rs.getString(2)+ " "+rs.getString(3) +" " + rs.getString(4)+"<br>");
SearchProjVO projVO = new SearchProjVO();
projVO.setProjid(rs.getString(1));
projVO.setProjname(rs.getString(2));
projVO.setCost(rs.getString(3));
projVO.setManager(rs.getString(4));
ar.add(projVO);
}
in jsp i am calling those variables in the following format is this correct
<td class="td-highlighted-2">
<div align="left"><a href="UpdateProject.html">${resultList.projId}</a></div>
</td>
<td class="td-highlighted-2">
<div align="left">${resultList.projName}</div>
</td>
<td class="td-highlighted-2">
<div align="left">${resultList.cost}</div>
</td>
<td class="td-highlighted-2">
<div align="left">${resultList.manager}</div>
</td>
</tr>
</c:forEach>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在迭代结果列表。假设您的 List 中有一个 SearchProjVO 对象列表,可以从您的页面访问,那么类似这样的操作将起作用:
It looks like you are iterating through a result list. Assuming you had a list of SearchProjVO objects in a List that was accessible from your page then something like this would work: