1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.strutsel.taglib.bean;
19
20 import org.apache.struts.taglib.bean.StrutsTag;
21 import org.apache.strutsel.taglib.utils.EvalHelper;
22
23 import javax.servlet.jsp.JspException;
24
25 /***
26 * Define a scripting variable that exposes the requested Struts internal
27 * configuraton object. <p> This class is a subclass of the class
28 * <code>org.apache.struts.taglib.bean.StrutsTag</code> which provides most of
29 * the described functionality. This subclass allows all attribute values to
30 * be specified as expressions utilizing the JavaServer Pages Standard Library
31 * expression language.
32 *
33 * @version $Rev: 376778 $
34 */
35 public class ELStrutsTag extends StrutsTag {
36 /***
37 * Instance variable mapped to "id" tag attribute. (Mapping set in
38 * associated BeanInfo class.)
39 */
40 private String idExpr;
41
42 /***
43 * Instance variable mapped to "formBean" tag attribute. (Mapping set in
44 * associated BeanInfo class.)
45 */
46 private String formBeanExpr;
47
48 /***
49 * Instance variable mapped to "forward" tag attribute. (Mapping set in
50 * associated BeanInfo class.)
51 */
52 private String forwardExpr;
53
54 /***
55 * Instance variable mapped to "mapping" tag attribute. (Mapping set in
56 * associated BeanInfo class.)
57 */
58 private String mappingExpr;
59
60 /***
61 * Getter method for "id" tag attribute. (Mapping set in associated
62 * BeanInfo class.)
63 */
64 public String getIdExpr() {
65 return (idExpr);
66 }
67
68 /***
69 * Getter method for "formBean" tag attribute. (Mapping set in associated
70 * BeanInfo class.)
71 */
72 public String getFormBeanExpr() {
73 return (formBeanExpr);
74 }
75
76 /***
77 * Getter method for "forward" tag attribute. (Mapping set in associated
78 * BeanInfo class.)
79 */
80 public String getForwardExpr() {
81 return (forwardExpr);
82 }
83
84 /***
85 * Getter method for "mapping" tag attribute. (Mapping set in associated
86 * BeanInfo class.)
87 */
88 public String getMappingExpr() {
89 return (mappingExpr);
90 }
91
92 /***
93 * Setter method for "id" tag attribute. (Mapping set in associated
94 * BeanInfo class.)
95 */
96 public void setIdExpr(String idExpr) {
97 this.idExpr = idExpr;
98 }
99
100 /***
101 * Setter method for "formBean" tag attribute. (Mapping set in associated
102 * BeanInfo class.)
103 */
104 public void setFormBeanExpr(String formBeanExpr) {
105 this.formBeanExpr = formBeanExpr;
106 }
107
108 /***
109 * Setter method for "forward" tag attribute. (Mapping set in associated
110 * BeanInfo class.)
111 */
112 public void setForwardExpr(String forwardExpr) {
113 this.forwardExpr = forwardExpr;
114 }
115
116 /***
117 * Setter method for "mapping" tag attribute. (Mapping set in associated
118 * BeanInfo class.)
119 */
120 public void setMappingExpr(String mappingExpr) {
121 this.mappingExpr = mappingExpr;
122 }
123
124 /***
125 * Resets attribute values for tag reuse.
126 */
127 public void release() {
128 super.release();
129 setIdExpr(null);
130 setFormBeanExpr(null);
131 setForwardExpr(null);
132 setMappingExpr(null);
133 }
134
135 /***
136 * Process the start tag.
137 *
138 * @throws JspException if a JSP exception has occurred
139 */
140 public int doStartTag() throws JspException {
141 evaluateExpressions();
142
143 return (super.doStartTag());
144 }
145
146 /***
147 * Processes all attribute values which use the JSTL expression evaluation
148 * engine to determine their values.
149 *
150 * @throws JspException if a JSP exception has occurred
151 */
152 private void evaluateExpressions()
153 throws JspException {
154 String string = null;
155
156 if ((string =
157 EvalHelper.evalString("id", getIdExpr(), this, pageContext)) != null) {
158 setId(string);
159 }
160
161 if ((string =
162 EvalHelper.evalString("formBean", getFormBeanExpr(), this,
163 pageContext)) != null) {
164 setFormBean(string);
165 }
166
167 if ((string =
168 EvalHelper.evalString("forward", getForwardExpr(), this,
169 pageContext)) != null) {
170 setForward(string);
171 }
172
173 if ((string =
174 EvalHelper.evalString("mapping", getMappingExpr(), this,
175 pageContext)) != null) {
176 setMapping(string);
177 }
178 }
179 }