1 16 17 package org.apache.taglibs.response; 18 19 import java.util.*; 20 import javax.servlet.*; 21 import javax.servlet.http.*; 22 import javax.servlet.jsp.*; 23 import javax.servlet.jsp.tagext.*; 24 25 45 46 public class AddHeaderTag extends BodyTagSupport 47 { 48 private String name = null; 49 50 55 public final int doStartTag() throws JspException 56 { 57 return EVAL_BODY_TAG; 58 } 59 60 65 public final int doAfterBody() throws JspException 66 { 67 BodyContent body = getBodyContent(); 69 String s = body.getString().trim(); 70 body.clearBody(); 73 74 ((HttpServletResponse)pageContext.getResponse()).addHeader(name,s); 75 return SKIP_BODY; 76 } 77 78 83 public final void setName(String nam) 84 { 85 name = nam; 86 } 87 88 } 89 | Popular Tags |