KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > faces > taglib > FormTag


1 /*
2  * Copyright 2002-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
17 package org.apache.struts.faces.taglib;
18
19
20 import javax.faces.component.UIComponent;
21
22
23 /**
24  * <p>Render an input form that is submitted to a Struts <code>Action</code>,
25  * for the <em>Struts-Faces Integration Library</em>.</p>
26  *
27  * @version $Rev: 54934 $ $Date: 2004-10-16 18:07:50 +0100 (Sat, 16 Oct 2004) $
28  */

29
30 public class FormTag extends AbstractFacesTag {
31
32
33     // ---------------------------------------------------------- Tag Attributes
34

35
36     /**
37      * <p>The <code>path</code> of the Struts <code>Action</code> to which
38      * this form should be submitted. This property is analogous to the
39      * <code>formName</code> property on the form tag in the standard
40      * HTML RenderKit.</p>
41      */

42     protected String JavaDoc action = null;
43
44     public void setAction(String JavaDoc action) {
45         this.action = action;
46     }
47
48
49     /**
50      * <p>The content encoding type to use.</p>
51      */

52     protected String JavaDoc enctype = null;
53
54     public void setEnctype(String JavaDoc enctype) {
55         this.enctype = enctype;
56     }
57
58
59     /**
60      * <p>The name of the field to which focus should be set when this
61      * form is displayed.</p>
62      */

63     protected String JavaDoc focus = null;
64
65     public void setFocus(String JavaDoc focus) {
66         this.focus = focus;
67     }
68
69
70     /**
71      * <p>The subscript of the focus field array to receive focus.</p>
72      */

73     protected String JavaDoc focusIndex = null;
74
75     public void setFocusIndex(String JavaDoc focusIndex) {
76         this.focusIndex = focusIndex;
77     }
78
79
80     /**
81      * <p>The JavaScript reset event handler.</p>
82      */

83     protected String JavaDoc onreset = null;
84
85     public void setOnreset(String JavaDoc onreset) {
86         this.onreset = onreset;
87     }
88
89
90     /**
91      * <p>The JavaScript submit event handler.</p>
92      */

93     protected String JavaDoc onsubmit = null;
94
95     public void setOnsubmit(String JavaDoc onsubmit) {
96         this.onsubmit = onsubmit;
97     }
98
99
100     /**
101      * <p>The window target for this submit.</p>
102      */

103     protected String JavaDoc target = null;
104
105     public void setTarget(String JavaDoc target) {
106         this.target = target;
107     }
108
109
110     // ------------------------------------------------------------- Tag Methods
111

112
113     /**
114      * <p>Release any allocated resources.</p>
115      */

116     public void release() {
117
118         super.release();
119         action = null;
120         enctype = null;
121         focus = null;
122         focusIndex = null;
123         onreset = null;
124         onsubmit = null;
125         target = null;
126
127     }
128
129
130     // ---------------------------------------------------------- Public Methods
131

132
133     /**
134      * <p>Return the type of component to be created for this tag.</p>
135      */

136     public String JavaDoc getComponentType() {
137
138         return ("org.apache.struts.faces.Form");
139
140     }
141
142
143     /**
144      * <p>Return the <code>rendererType</code> to be used for rendering
145      * our component.</p>
146      */

147     public String JavaDoc getRendererType() {
148
149         return ("org.apache.struts.faces.Form");
150
151     }
152
153
154     // ------------------------------------------------------- Protected Methods
155

156
157     /**
158      * <p>Override attributes set on this tag instance.</p>
159      *
160      * @param component Component whose attributes should be overridden
161      */

162     protected void setProperties(UIComponent component) {
163
164         super.setProperties(component);
165         setStringAttribute(component, "action", action);
166         setStringAttribute(component, "enctype", enctype);
167         setStringAttribute(component, "focus", focus);
168         setStringAttribute(component, "focusIndex", focusIndex);
169         setStringAttribute(component, "onreset", onreset);
170         setStringAttribute(component, "onsubmit", onsubmit);
171         setStringAttribute(component, "target", target);
172
173     }
174
175
176 }
177
Popular Tags