日期:2014-05-16  浏览次数:20573 次

数据库中查询出来的list以map类型遍历取值

public void getIpOption() {
		//获取参数
		String resTypeId = (String) this.httpServletRequest.getParameter("resTypeId");
		//获取数据集,从数据库中获得list
		List<Map> list = sysLogService.getIpOption(resTypeId);
		
		//循环加入
		StringBuffer sb = new StringBuffer();
               //以map的类型,进行遍历取值
		for (Map map : list) {
			String RESOURCENAME = String.valueOf(map.get("RESOURCENAME"));
			String IP_ADDRESS = String.valueOf(map.get("IP_ADDRESS"));

			sb.append("<option value='" + IP_ADDRESS + "'>" + RESOURCENAME + " : " + IP_ADDRESS + "</option>");
		}
		
		//输出
		this.outPrintStrToPage(sb.toString());
	}