1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.struts.faces.taglib;
23
24
25 import javax.faces.component.UIComponent;
26
27
28 /**
29 * <p>Render an input form that is submitted to a Struts <code>Action</code>,
30 * for the <em>Struts-Faces Integration Library</em>.</p>
31 *
32 * @version $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
33 */
34
35 public class FormTag extends AbstractFacesTag {
36
37
38
39
40
41 /**
42 * <p>The <code>path</code> of the Struts <code>Action</code> to which
43 * this form should be submitted. This property is analogous to the
44 * <code>formName</code> property on the form tag in the standard
45 * HTML RenderKit.</p>
46 */
47 protected String action = null;
48
49 public void setAction(String action) {
50 this.action = action;
51 }
52
53
54 /**
55 * <p>The content encoding type to use.</p>
56 */
57 protected String enctype = null;
58
59 public void setEnctype(String enctype) {
60 this.enctype = enctype;
61 }
62
63
64 /**
65 * <p>The name of the field to which focus should be set when this
66 * form is displayed.</p>
67 */
68 protected String focus = null;
69
70 public void setFocus(String focus) {
71 this.focus = focus;
72 }
73
74
75 /**
76 * <p>The subscript of the focus field array to receive focus.</p>
77 */
78 protected String focusIndex = null;
79
80 public void setFocusIndex(String focusIndex) {
81 this.focusIndex = focusIndex;
82 }
83
84
85 /**
86 * <p>The JavaScript reset event handler.</p>
87 */
88 protected String onreset = null;
89
90 public void setOnreset(String onreset) {
91 this.onreset = onreset;
92 }
93
94
95 /**
96 * <p>The JavaScript submit event handler.</p>
97 */
98 protected String onsubmit = null;
99
100 public void setOnsubmit(String onsubmit) {
101 this.onsubmit = onsubmit;
102 }
103
104
105 /**
106 * <p>The window target for this submit.</p>
107 */
108 protected String target = null;
109
110 public void setTarget(String target) {
111 this.target = target;
112 }
113
114
115
116
117
118 /**
119 * <p>Release any allocated resources.</p>
120 */
121 public void release() {
122
123 super.release();
124 action = null;
125 enctype = null;
126 focus = null;
127 focusIndex = null;
128 onreset = null;
129 onsubmit = null;
130 target = null;
131
132 }
133
134
135
136
137
138 /**
139 * <p>Return the type of component to be created for this tag.</p>
140 */
141 public String getComponentType() {
142
143 return ("org.apache.struts.faces.Form");
144
145 }
146
147
148 /**
149 * <p>Return the <code>rendererType</code> to be used for rendering
150 * our component.</p>
151 */
152 public String getRendererType() {
153
154 return ("org.apache.struts.faces.Form");
155
156 }
157
158
159
160
161
162 /**
163 * <p>Override attributes set on this tag instance.</p>
164 *
165 * @param component Component whose attributes should be overridden
166 */
167 protected void setProperties(UIComponent component) {
168
169 super.setProperties(component);
170 setStringAttribute(component, "action", action);
171 setStringAttribute(component, "enctype", enctype);
172 setStringAttribute(component, "focus", focus);
173 setStringAttribute(component, "focusIndex", focusIndex);
174 setStringAttribute(component, "onreset", onreset);
175 setStringAttribute(component, "onsubmit", onsubmit);
176 setStringAttribute(component, "target", target);
177
178 }
179
180
181 }