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 40 41 public class SetHeaderTag extends BodyTagSupport 42 { 43 private String name = null; 44 45 50 public final int doStartTag() throws JspException 51 { 52 return EVAL_BODY_TAG; 53 } 54 55 60 public final int doAfterBody() throws JspException 61 { 62 BodyContent body = getBodyContent(); 64 String s = body.getString().trim(); 65 body.clearBody(); 68 69 ((HttpServletResponse)pageContext.getResponse()).setHeader(name,s); 70 return SKIP_BODY; 71 } 72 73 78 public final void setName(String nam) 79 { 80 name = nam; 81 } 82 83 } 84 | Popular Tags |