1 53 54 106 107 package com.Yasna.forum.tags; 108 109 import java.io.*; 110 import java.util.*; 111 import javax.servlet.*; 112 import javax.servlet.jsp.*; 113 import javax.servlet.jsp.tagext.*; 114 import javax.servlet.http.*; 115 import com.Yasna.forum.tags.*; 116 117 154 public class MatchTag extends BodyTagSupport 155 { 156 private String property = null; 157 private Map match = new HashMap(); 158 159 165 public final int doStartTag() throws JspException 166 { 167 return EVAL_BODY_TAG; 168 } 169 170 175 public final int doAfterBody() throws JspException 176 { 177 BodyContent body = getBodyContent(); 179 String s = body.getString(); 180 body.clearBody(); 182 183 MatchTag fmt = 185 (MatchTag)pageContext.getAttribute(id,PageContext.PAGE_SCOPE); 186 if( fmt != null ) { 187 fmt.addMatch(property,s); 188 } else { addMatch(property,s); 190 match.put(property,(Object )s); 191 pageContext.setAttribute(id,this,PageContext.PAGE_SCOPE); 192 } 193 return SKIP_BODY; 194 } 195 196 199 public final void setProperty(String str) 200 { 201 property = str; 202 } 203 204 207 public final void addMatch(String prop, String value) 208 { 209 match.put(prop,(Object )value); 210 } 211 212 217 public final Map getMatch() 218 { 219 return match; 220 } 221 } 222 | Popular Tags |