1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts.taglib.nested.html;
22
23 import org.apache.struts.taglib.html.FormTag;
24 import org.apache.struts.taglib.nested.NestedNameSupport;
25 import org.apache.struts.taglib.nested.NestedPropertyHelper;
26
27 import javax.servlet.http.HttpServletRequest;
28 import javax.servlet.jsp.JspException;
29
30 /**
31 * NestedFormTag.
32 *
33 * @version $Rev: 471754 $ $Date: 2004-10-16 12:38:42 -0400 (Sat, 16 Oct 2004)
34 * $
35 * @since Struts 1.1
36 */
37 public class NestedFormTag extends FormTag implements NestedNameSupport {
38
39
40
41
42 /**
43 * The name
44 */
45 protected String name = null;
46
47
48 private String originalNesting = null;
49 private String originalNestingName = null;
50
51 /**
52 * Return the name.
53 */
54 public String getName() {
55 return (this.name);
56 }
57
58 /**
59 * Set the name.
60 *
61 * @param name The new name
62 */
63 public void setName(String name) {
64 this.name = name;
65 }
66
67 /**
68 * Get the string value of the "property" property.
69 *
70 * @return the property property
71 */
72 public String getProperty() {
73 return "";
74 }
75
76 /**
77 * Setter for the "property" property
78 *
79 * @param newProperty new value for the property
80 */
81 public void setProperty(String newProperty) {
82 }
83
84 /**
85 * Overriding to allow the chance to set the details of the system, so
86 * that dynamic includes can be possible
87 *
88 * @return int JSP continuation directive.
89 */
90 public int doStartTag() throws JspException {
91
92 int temp = super.doStartTag();
93
94 HttpServletRequest request =
95 (HttpServletRequest) pageContext.getRequest();
96
97
98 originalNesting = NestedPropertyHelper.getCurrentProperty(request);
99 originalNestingName =
100 NestedPropertyHelper.getCurrentName(request, this);
101
102
103 NestedPropertyHelper.setProperty(request, null);
104 NestedPropertyHelper.setName(request, super.getBeanName());
105
106
107 return temp;
108 }
109
110 /**
111 * This is only overriden to clean up the include reference
112 *
113 * @return int JSP continuation directive.
114 */
115 public int doEndTag() throws JspException {
116
117 int temp = super.doEndTag();
118
119
120 HttpServletRequest request =
121 (HttpServletRequest) pageContext.getRequest();
122
123
124 if (originalNesting == null) {
125 NestedPropertyHelper.deleteReference(request);
126 } else {
127 NestedPropertyHelper.setProperty(request, originalNesting);
128 NestedPropertyHelper.setName(request, originalNestingName);
129 }
130
131
132 return temp;
133 }
134
135 /**
136 * Release the tag's resources and reset the values.
137 */
138 public void release() {
139
140 super.release();
141
142
143 originalNesting = null;
144 originalNestingName = null;
145 }
146 }