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.SubmitTag;
21 import org.apache.struts.taglib.nested.NestedPropertyHelper;
22 import org.apache.struts.taglib.nested.NestedPropertySupport;
23
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.jsp.JspException;
26
27 /***
28 * NestedSubmitTag.
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 NestedSubmitTag extends SubmitTag implements NestedPropertySupport {
35
36 private String originalProperty = null;
37
38 /***
39 * Overriding method of the heart of the matter. Gets the relative
40 * property and leaves the rest up to the original tag implementation.
41 * Sweet.
42 *
43 * @return int JSP continuation directive. This is in the hands of the
44 * super class.
45 */
46 public int doStartTag() throws JspException {
47
48 originalProperty = getProperty();
49
50
51 HttpServletRequest request =
52 (HttpServletRequest) pageContext.getRequest();
53
54
55 NestedPropertyHelper.setNestedProperties(request, this);
56
57
58 return super.doStartTag();
59 }
60
61 /***
62 * Complete the processing of the tag. The nested tags here will restore
63 * all the original value for the tag itself and the nesting context.
64 *
65 * @return int to describe the next step for the JSP processor
66 * @throws JspException for the bad things JSP's do
67 */
68 public int doEndTag() throws JspException {
69
70 int i = super.doEndTag();
71
72
73 setProperty(originalProperty);
74
75
76 return i;
77 }
78
79 /***
80 * Release the tag's resources and reset the values.
81 */
82 public void release() {
83 super.release();
84
85
86 originalProperty = null;
87 }
88 }