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