jsp访问MySQL中的数据 读不出来
Java的相关代码
<%protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String sql="select * from tb_admin order by id desc";
DBUtils dbUtils=new DBUtils();
Listlist=(List) dbUtils.executeQueryBeans(sql,TbAdmin.class);
//找到记录
request.setAttribute("list",list);
request.getRequestDispatcher("admin/admin_Edit.jsp").forward(request,response);
%>
jsp的相关代码
<%
List<TbAdmin> list=(List<TbAdmin>) request.getAttribute("list");
if (list!=null) {
for (TbAdmin tbAdmin : list) {//遍历
%>
<tr>
<td style="text-align: center;"><input type="checkbox" name="chAll" id="chAll" value=""/></td>
<td style="text-align: center;"><%=tbAdmin.getId()%></td>
<td><%=tbAdmin.getUserName()%></td>
<td><%=tbAdmin.getUserPsw()%></td>
<td style="text-align: center;"><a
href="#"
onclick="return confirm('确定要删除?')">删除</a></td>
<td style="text-align: center;"><a
href="#"
target="rightFrame">修改</a></td>
</tr>
<%
}
}
%>
这是想达到的目的
但是目前只做出了