KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > servlet > tags > HtmlEscapeTag


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.web.servlet.tags;
18
19 import javax.servlet.jsp.JspException JavaDoc;
20
21 import org.springframework.web.util.ExpressionEvaluationUtils;
22
23 /**
24  * Sets default HTML escape value for the current page. The actual value
25  * can be overridden by escaping-aware tags. The default is "false".
26  *
27  * <p>Note: You can also set a "defaultHtmlEscape" web.xml context-param.
28  * A page-level setting overrides a context-param.
29  *
30  * @author Juergen Hoeller
31  * @since 04.03.2003
32  * @see HtmlEscapingAwareTag#setHtmlEscape
33  */

34 public class HtmlEscapeTag extends RequestContextAwareTag {
35
36     private String JavaDoc defaultHtmlEscape;
37
38
39     /**
40      * Set the default value for HTML escaping,
41      * to be put into the current PageContext.
42      */

43     public void setDefaultHtmlEscape(String JavaDoc defaultHtmlEscape) {
44         this.defaultHtmlEscape = defaultHtmlEscape;
45     }
46
47
48     protected int doStartTagInternal() throws JspException JavaDoc {
49         boolean resolvedDefaultHtmlEscape =
50                 ExpressionEvaluationUtils.evaluateBoolean("defaultHtmlEscape", this.defaultHtmlEscape, pageContext);
51         getRequestContext().setDefaultHtmlEscape(resolvedDefaultHtmlEscape);
52         return EVAL_BODY_INCLUDE;
53     }
54
55 }
56
Popular Tags