1 25 26 29 package net.killingar.webwork.view.taglib; 30 31 import webwork.util.TextUtil; 32 33 import javax.servlet.jsp.JspException ; 34 import javax.servlet.jsp.JspTagException ; 35 36 public class FocusTag extends webwork.view.taglib.WebWorkBodyTagSupport 37 { 38 protected String valueAttr; 40 protected Boolean escape = new Boolean (false); 41 42 public void setValue(String inName) 44 { 45 valueAttr = inName; 46 } 47 48 public void setEscape(boolean inEscape) 49 { 50 escape = new Boolean (inEscape); 51 } 52 53 public int doStartTag() throws JspException 55 { 56 Object value = findValue(valueAttr); 57 getStack().pushValue(value); 58 59 return EVAL_BODY_TAG; 60 } 61 62 public int doAfterBody() throws JspException 63 { 64 return SKIP_BODY; 65 } 66 67 public int doEndTag() throws JspException 68 { 69 Object value = getStack().popValue(); 70 71 String body = null; 72 try 73 { 74 body = getBodyContent().getString(); 75 } 76 catch (Exception e) 77 { 78 body = new String (""); 79 } 80 81 try 82 { 83 if (escape.booleanValue()) 84 body = TextUtil.escapeHTML(body); 85 86 bodyContent.getEnclosingWriter().write(body); 87 } 88 catch (java.io.IOException e) 89 { 90 throw new JspTagException ("Could not show attribute " + valueAttr + ":" + e); 91 } 92 93 107 return EVAL_PAGE; 108 } 109 } | Popular Tags |