1 16 17 package org.apache.taglibs.request; 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 44 45 public class HeaderTag extends TagSupport 46 { 47 private String name = null; 49 50 55 public final int doEndTag() throws JspException 56 { 57 String value = 58 ((HttpServletRequest)pageContext.getRequest()).getHeader(name); 59 if( value == null ) 60 value = ""; 61 62 try { 63 pageContext.getOut().write(value); 64 } catch(Exception e) { 65 throw new JspException("IO Error: " + e.getMessage()); 66 } 67 return EVAL_PAGE; 68 } 69 70 75 public final void setName(String str) 76 { 77 name = str; 78 } 79 80 } 81 | Popular Tags |