1 16 17 18 package org.apache.webapp.admin; 19 20 21 import java.io.IOException ; 22 import java.net.URLEncoder ; 23 import java.util.ArrayList ; 24 import javax.servlet.http.HttpServletResponse ; 25 import javax.servlet.jsp.JspException ; 26 import javax.servlet.jsp.JspWriter ; 27 import javax.servlet.jsp.PageContext ; 28 import javax.servlet.jsp.tagext.BodyTagSupport ; 29 import javax.servlet.jsp.tagext.Tag ; 30 31 32 44 45 public class DataTag extends BodyTagSupport { 46 47 48 50 51 54 protected String data = null; 55 56 57 59 60 65 public int doStartTag() throws JspException { 66 67 this.data = null; 69 70 return (EVAL_BODY_TAG); 72 73 } 74 75 76 81 public int doAfterBody() throws JspException { 82 83 String data = bodyContent.getString(); 84 if (data != null) { 85 data = data.trim(); 86 if (data.length() > 0) 87 this.data = data; 88 } 89 return (SKIP_BODY); 90 91 } 92 93 94 99 public int doEndTag() throws JspException { 100 101 Tag parent = getParent(); 103 if ((parent == null) || !(parent instanceof RowTag)) 104 throw new JspException ("Must be nested in a rowTag isntance"); 105 RowTag row = (RowTag) parent; 106 107 HttpServletResponse response = 110 (HttpServletResponse ) pageContext.getResponse(); 111 row.setData(data); 112 113 return (EVAL_PAGE); 114 115 } 116 117 118 121 public void release() { 122 123 this.data = null; 124 } 125 126 127 } 128 | Popular Tags |