KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > string > DeleteTag


1 /*
2  * Copyright 1999,2004 The Apache Software Foundation.
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 package org.apache.taglibs.string;
17
18 import javax.servlet.jsp.JspException JavaDoc;
19 import org.apache.commons.lang.CharSetUtils;
20
21 /**
22  * Delete any characters from the body that match
23  * characters specified in the Set.
24  * The syntax of a Set is described in the CountTag javadoc.
25  *
26  * <dl>
27  * <dt>set</dt><dd>
28  * Character Set to look for.
29  * Required.
30  * </dd>
31  * </dl>
32  *
33  * @author bayard@generationjava.com
34  */

35 public class DeleteTag extends StringTagSupport {
36
37     private String JavaDoc set;
38
39     public DeleteTag() {
40         super();
41     }
42
43     /**
44      * Get the set property
45      *
46      * @return String property
47      */

48     public String JavaDoc getSet() {
49         return this.set;
50     }
51
52     /**
53      * Set the set property
54      *
55      * @param set String property
56      */

57     public void setSet(String JavaDoc set) {
58         this.set = set;
59     }
60
61
62
63     public String JavaDoc changeString(String JavaDoc text) throws JspException JavaDoc {
64         return CharSetUtils.delete(text, set);
65     }
66
67     public void initAttributes() {
68
69         this.set = null;
70
71     }
72
73 }
74
Popular Tags