1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts.taglib.nested.logic;
19
20 import org.apache.struts.taglib.logic.EmptyTag;
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 * NestedEmptyTag.
29 *
30 * @version $Rev: 376843 $ $Date: 2004-10-16 12:38:42 -0400 (Sat, 16 Oct 2004)
31 * $
32 * @since Struts 1.1
33 */
34 public class NestedEmptyTag extends EmptyTag implements NestedNameSupport {
35
36 private String originalName = null;
37 private String originalProperty = null;
38
39 /***
40 * Overriding method of the heart of the matter. Gets the relative
41 * property and leaves the rest up to the original tag implementation.
42 * Sweet.
43 *
44 * @return int JSP continuation directive. This is in the hands of the
45 * super class.
46 */
47 public int doStartTag() throws JspException {
48
49 originalName = getName();
50 originalProperty = getProperty();
51
52
53 HttpServletRequest request =
54 (HttpServletRequest) pageContext.getRequest();
55
56
57 NestedPropertyHelper.setNestedProperties(request, this);
58
59
60 return super.doStartTag();
61 }
62
63 /***
64 * Complete the processing of the tag. The nested tags here will restore
65 * all the original value for the tag itself and the nesting context.
66 *
67 * @return int to describe the next step for the JSP processor
68 * @throws JspException for the bad things JSP's do
69 */
70 public int doEndTag() throws JspException {
71
72 int i = super.doEndTag();
73
74
75 setName(originalName);
76 setProperty(originalProperty);
77
78
79 return i;
80 }
81
82 /***
83 * Release the tag's resources and reset the values.
84 */
85 public void release() {
86 super.release();
87
88
89 originalName = null;
90 originalProperty = null;
91 }
92 }