⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iteratemaptag.java

📁 基于SSH (struts+spring+hibernate)框架设计的 CRM客户关系管理系统
💻 JAVA
字号:
package com.csu.crm.common.tag;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
/**
 * 
 * @author 3eCRM小组:曾东
 * @since 2007-9-30 下午04:05:19
 * @version 1.0 创建时间:2007-9-30 下午04:05:19,初始版本
 */
public class IterateMapTag extends SimpleTagSupport{
	private Map map;
	private List list;
	private String name;
	
	public Map getMap() {
		return map;
	}

	public void setMap(Map map) {
		this.map = map;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}

	public void doTag() throws JspException,IOException {
		/**
		 * 打印如下形式
		 * <select name="bank">
		 */
		String selectString = "<select name='" + name +"'> ";
		getJspContext().getOut().println(selectString);
		String str = "<option id='notSelect'>---请选择---</option>";
		getJspContext().getOut().println(str);
		//--------------------------------------------------------
		Iterator ite = list.iterator();
		while(ite.hasNext()) {
			String cur = (String)ite.next();
			String curId = (String)map.get(cur);
			
			/**
			 * 打印如下形式
			 * <option id="<%=curBank%>">
			 * 		<%=curBank%>
			 * </option>
			 */
			String tmp = "<option id='" + curId +"'> " +cur+ "</option>";
			getJspContext().getOut().println(tmp);			
		}	
		//--------------------------------------------------------		
		/**
		 * 打印如下形式
		 * </select>
		 */
		selectString = "</select>";
		getJspContext().getOut().println(selectString);
//		getJspBody().invoke(null);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -