KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > taglibs > util > Xmp


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.taglibs.util;
14
15 import java.io.IOException JavaDoc;
16
17 import javax.servlet.jsp.JspWriter JavaDoc;
18 import javax.servlet.jsp.tagext.BodyTagSupport JavaDoc;
19
20 import org.apache.commons.lang.StringEscapeUtils;
21 import org.apache.commons.lang.exception.NestableRuntimeException;
22
23
24 /**
25  * Escapes html in body.
26  * @author Marcel Salathe
27  * @author Fabrizio Giustina
28  * @version $Revision $ ($Author $)
29  */

30 public class Xmp extends BodyTagSupport JavaDoc {
31
32     /**
33      * Stable serialVersionUID.
34      */

35     private static final long serialVersionUID = 222L;
36
37     /**
38      * @see javax.servlet.jsp.tagext.Tag#doEndTag()
39      */

40     public int doEndTag() {
41         JspWriter JavaDoc out = pageContext.getOut();
42         String JavaDoc xmpString = getBodyContent().getString();
43         try {
44             out.print(StringEscapeUtils.escapeHtml(xmpString));
45         }
46         catch (IOException JavaDoc e) {
47             // should never happen
48
throw new NestableRuntimeException(e);
49         }
50         return EVAL_PAGE;
51     }
52
53 }
54
Popular Tags