for (int i = 0; i < userList.size(); i++) {这句有问题?哪位高手指导下为什么会错?这个迭代本身是没错
代码如下<%@pagelanguage="java"import="java.util.*"pageEncoding="GB18030"%><%@pageimport="...
代码如下
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@page import="com.ee.bean.UserBean"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'adminInfo.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form name="queryUser" action="<%=path %>/com.servlet/servlet/UserServlet?task=userList"target="mainFrame" method="post">
真实名称:<input name="truename" type="text" >
<input type="submit" value="查询" >
</form>
<hr color="red" width="100%">
<%
List<UserBean> userList = (List)request.getAttribute("userList");
%>
用户管理列表
<br>
<div align="center">
<table border="1" width="100%">
<tr>
<td>
用户ID
</td>
<td>
用户名称
</td>
<td>
真实姓名
</td>
<td>
用户密码
</td>
<td>
操作
</td>
</tr>
<%
for (int i = 0; i < userList.size(); i++) {
UserBean userBean = userList.get(i);
%>
<tr>
<td><%=userBean.getUserid()%></td>
<td><%=userBean.getUsername()%></td>
<td><%=userBean.getRealname()%></td>
<td><%=userBean.getPassword()%></td>
<td>
<a href="<%=path %>/com.servlet/servlet/UserServlet?task=seeUser&userId=<%=userBean.getUserid()%>">查看</a>/<a href="<%=path %>/com.servlet/servlet/UserServlet?task=updateUser&userId=<%=userBean.getUserid()%>">修改</a>/<a href="<%=path %>/com.servlet/servlet/UserServlet?task=deleteUser&userId=<%=userBean.getUserid()%>">删除</a>
</td>
</tr>
<%
userBean.getUsername();
}
%>
</table>
</div>
</body>
</html> 展开
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@page import="com.ee.bean.UserBean"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'adminInfo.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form name="queryUser" action="<%=path %>/com.servlet/servlet/UserServlet?task=userList"target="mainFrame" method="post">
真实名称:<input name="truename" type="text" >
<input type="submit" value="查询" >
</form>
<hr color="red" width="100%">
<%
List<UserBean> userList = (List)request.getAttribute("userList");
%>
用户管理列表
<br>
<div align="center">
<table border="1" width="100%">
<tr>
<td>
用户ID
</td>
<td>
用户名称
</td>
<td>
真实姓名
</td>
<td>
用户密码
</td>
<td>
操作
</td>
</tr>
<%
for (int i = 0; i < userList.size(); i++) {
UserBean userBean = userList.get(i);
%>
<tr>
<td><%=userBean.getUserid()%></td>
<td><%=userBean.getUsername()%></td>
<td><%=userBean.getRealname()%></td>
<td><%=userBean.getPassword()%></td>
<td>
<a href="<%=path %>/com.servlet/servlet/UserServlet?task=seeUser&userId=<%=userBean.getUserid()%>">查看</a>/<a href="<%=path %>/com.servlet/servlet/UserServlet?task=updateUser&userId=<%=userBean.getUserid()%>">修改</a>/<a href="<%=path %>/com.servlet/servlet/UserServlet?task=deleteUser&userId=<%=userBean.getUserid()%>">删除</a>
</td>
</tr>
<%
userBean.getUsername();
}
%>
</table>
</div>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询