1 18 package org.apache.beehive.netui.tags.html; 19 20 22 import org.apache.beehive.netui.tags.AbstractClassicTag; 23 import org.apache.beehive.netui.util.Bundle; 24 25 import javax.servlet.jsp.JspException ; 26 import javax.servlet.jsp.tagext.Tag ; 27 import java.util.Iterator ; 28 import java.util.Map ; 29 30 64 public class ParameterMap 65 extends AbstractClassicTag 66 { 67 private Map _map = null; 68 69 72 public String getTagName() 73 { 74 return "ParameterMap"; 75 } 76 77 90 public void setMap(Map map) throws JspException 91 { 92 if (map == null) { 93 String s = Bundle.getString("Tags_MapAttrValueRequired", new Object []{"map"}); 94 registerTagError(s, null); 95 } 96 _map = map; 97 } 98 99 103 public int doStartTag() throws JspException 104 { 105 if (hasErrors()) 106 return reportAndExit(SKIP_BODY); 107 108 Tag parentTag = findAncestorWithClass(this, IUrlParams.class); 109 if (parentTag != null) { 110 assert(_map != null); 112 IUrlParams parent = (IUrlParams) parentTag; 113 Iterator it = _map.entrySet().iterator(); 114 while (it.hasNext()) { 115 Map.Entry key = (Map.Entry ) it.next(); 116 parent.addParameter(key.getKey().toString(), key.getValue(), null); 117 } 118 } 119 else { 120 String msg = Bundle.getString("Tags_InvalidParameterMapParent"); 121 registerTagError(msg, null); 122 reportErrors(); 123 } 124 125 localRelease(); 126 return SKIP_BODY; 127 } 128 129 132 protected void localRelease() 133 { 134 super.localRelease(); 135 _map = null; 136 } 137 } 138 | Popular Tags |