usetlist.jsp代码:
List users = com.bjsxt.shopping.User.getUsers();
//List users = User.getUsers();
%>
titlefor(Iterator it = users.iterator();it.hasNext(); ){
User u = it.next();
%>
}
%>
User.java代码:
public class User {
字数限制,忽略部分内容
public static List getUsers() {
List users = new ArrayList();
Connection conn = null;
ResultSet rs = null;
try {
conn = DB.getConn();
String sql = "select * from ruser";
rs = DB.executeQuery(conn, sql);
while (rs.next()) {
User u = new User();
u.setId(rs.getInt("id"));
u.setUsername(rs.getString("username"));
u.setPassword(rs.getString("password"));
u.setPhone(rs.getString("phone"));
u.setAddr(rs.getString("addr"));
u.setRdate(rs.getTimestamp("rdate"));
users.add(u);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
DB.closeRs(rs);
DB.closeConn(conn);
}
return users;
}
}
userlist.jsp里调用user.java里的getUse()方法。总是提示getUser()没有被定义为User类型。但是在User.java里已经定义啦。请各位大侠帮忙看下,肿么回事哦
An error occurred at line: 7 in the jsp file: /admin/userlist.jsp
The method getUsers() is undefined for the type User
4:
5:
6:
7: List users = com.bjsxt.shopping.User.getUsers();
8:
9: %>