1 package de.jwi.jgallery.tags; 2 3 24 25 26 import java.io.IOException ; 27 28 import javax.servlet.jsp.JspTagException ; 29 import javax.servlet.jsp.JspWriter ; 30 import javax.servlet.jsp.tagext.BodyContent ; 31 import javax.servlet.jsp.tagext.BodyTagSupport ; 32 33 38 public class TextTag extends BodyTagSupport 39 { 40 41 public int doAfterBody() 42 throws JspTagException 43 { 44 BodyContent body = getBodyContent(); 45 String s = body.getString(); 46 if (!s.matches("\\w*")) 47 { 48 throw new JspTagException ("TextTag may not contain whitespace"); 49 } 50 51 53 try 54 { 55 JspWriter out = body.getEnclosingWriter(); 56 out.print(s); 57 } 58 catch (IOException ioe) 59 { 60 System.out.println("Error in TextTag: " + ioe); 61 } 62 return (SKIP_BODY); 63 } 64 65 } 66 | Popular Tags |