Jsp中遍历显示 List< Map> 的内容

Jsp中遍历显示  List >的内容
		List> listmap = adminService.getAllUser();
		List userlist = new ArrayList();
		for(Mapmap : listmap) {	//遍历里面的map	
			User user = CommonUtils.toBean(map, User.class);	//使用小工具将map封装成javaBean
			userlist.add(user);
		}
		req.setAttribute("userlist",userlist);

Jsp中的代码

				
                
	                
	                    ${user.userId}
	                    ${user.username}
	                    ${user.password}
	                    ${user.actualName}
	                    ${user.roleName}
	                    ${user.sex}
	                    ${user.phone}
	                    
	                    			
	                    		删除 | 
	                    		编辑		
	               			
	               		
	                																		
	                
                

Service层中的代码

	public List> getAllUser() throws SQLException {
		return adminDao.getAllUser();
	}

Dao层中的代码

	public List> getAllUser() throws SQLException{
		String sql = "select * from t_user";
		List> mapList = qr.query(sql, new MapListHandler());
		return mapList;
	}

你可能感兴趣的:(Jsp中遍历显示 List< Map> 的内容)