KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > taglib > html > CancelTag


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

18
19
20 package org.apache.struts.taglib.html;
21
22 import javax.servlet.jsp.JspException JavaDoc;
23
24
25 /**
26  * Tag for input fields of type "cancel".
27  *
28  * @version $Rev: 54954 $ $Date: 2004-10-17 07:40:12 +0100 (Sun, 17 Oct 2004) $
29  */

30
31 public class CancelTag extends SubmitTag {
32
33
34     // ------------------------------------------------------------- Properties
35

36
37     /** Returns the onClick event handler. */
38     public String JavaDoc getOnclick() {
39         return super.getOnclick() == null ? "bCancel=true;"
40                                : super.getOnclick();
41     }
42
43     // --------------------------------------------------------- Constructor
44

45     public CancelTag() {
46
47         super();
48         property = Constants.CANCEL_PROPERTY;
49
50     }
51
52     // --------------------------------------------------------- Protected Methods
53

54     /**
55      * Render the opening element.
56      *
57      * @return The opening part of the element.
58      */

59     protected String JavaDoc getElementOpen() {
60         return "<input type=\"submit\"";
61     }
62
63     /**
64      * Prepare the name element
65      * @return The element name.
66      */

67     protected String JavaDoc prepareName() throws JspException JavaDoc {
68         return property;
69     }
70
71     /**
72      * Return the default value.
73      *
74      * @return The default value if none supplied.
75      */

76     protected String JavaDoc getDefaultValue() {
77         return "Cancel";
78     }
79
80     /**
81      * Release any acquired resources.
82      */

83     public void release() {
84
85         super.release();
86         property = Constants.CANCEL_PROPERTY;
87
88     }
89
90 }
91
Popular Tags