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 157 public class QueryTag extends BodyTagSupport 158 { 159 private String property = null; 160 private Map query = new HashMap(); 161 162 168 public final int doStartTag() throws JspException 169 { 170 return EVAL_BODY_TAG; 171 } 172 173 178 public final int doAfterBody() throws JspException 179 { 180 BodyContent body = getBodyContent(); 182 String s = body.getString(); 183 body.clearBody(); 185 186 QueryTag qt = 188 (QueryTag)pageContext.getAttribute(id,PageContext.PAGE_SCOPE); 189 if( qt != null ) { 190 qt.addQuery(property,s); 191 } else { addQuery(property,s); 193 query.put(property,(Object )s); 194 pageContext.setAttribute(id,this,PageContext.PAGE_SCOPE); 195 } 196 return SKIP_BODY; 197 } 198 199 202 public final void setProperty(String str) 203 { 204 property = str; 205 } 206 207 210 public final void addQuery(String prop, String value) 211 { 212 query.put(prop,(Object )value); 213 } 214 215 220 public final Map getQuery() 221 { 222 return query; 223 } 224 } 225 | Popular Tags |