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.IncludeTag;
21 import org.apache.strutsel.taglib.utils.EvalHelper;
22
23 import javax.servlet.jsp.JspException;
24
25 /***
26 * Generate a URL-encoded include to the specified URI. <p> This class is a
27 * subclass of the class <code>org.apache.struts.taglib.bean.IncludeTag</code>
28 * which provides most of the described functionality. This subclass allows
29 * all attribute values to be specified as expressions utilizing the
30 * JavaServer Pages Standard Library expression language.
31 *
32 * @version $Rev: 376778 $
33 */
34 public class ELIncludeTag extends IncludeTag {
35 /***
36 * Instance variable mapped to "anchor" tag attribute. (Mapping set in
37 * associated BeanInfo class.)
38 */
39 private String anchorExpr;
40
41 /***
42 * Instance variable mapped to "forward" tag attribute. (Mapping set in
43 * associated BeanInfo class.)
44 */
45 private String forwardExpr;
46
47 /***
48 * Instance variable mapped to "href" tag attribute. (Mapping set in
49 * associated BeanInfo class.)
50 */
51 private String hrefExpr;
52
53 /***
54 * Instance variable mapped to "id" tag attribute. (Mapping set in
55 * associated BeanInfo class.)
56 */
57 private String idExpr;
58
59 /***
60 * Instance variable mapped to "page" tag attribute. (Mapping set in
61 * associated BeanInfo class.)
62 */
63 private String pageExpr;
64
65 /***
66 * Instance variable mapped to "transaction" tag attribute. (Mapping set
67 * in associated BeanInfo class.)
68 */
69 private String transactionExpr;
70
71 /***
72 * Getter method for "anchor" tag attribute. (Mapping set in associated
73 * BeanInfo class.)
74 */
75 public String getAnchorExpr() {
76 return (anchorExpr);
77 }
78
79 /***
80 * Getter method for "forward" tag attribute. (Mapping set in associated
81 * BeanInfo class.)
82 */
83 public String getForwardExpr() {
84 return (forwardExpr);
85 }
86
87 /***
88 * Getter method for "href" tag attribute. (Mapping set in associated
89 * BeanInfo class.)
90 */
91 public String getHrefExpr() {
92 return (hrefExpr);
93 }
94
95 /***
96 * Getter method for "id" tag attribute. (Mapping set in associated
97 * BeanInfo class.)
98 */
99 public String getIdExpr() {
100 return (idExpr);
101 }
102
103 /***
104 * Getter method for "page" tag attribute. (Mapping set in associated
105 * BeanInfo class.)
106 */
107 public String getPageExpr() {
108 return (pageExpr);
109 }
110
111 /***
112 * Getter method for "transaction" tag attribute. (Mapping set in
113 * associated BeanInfo class.)
114 */
115 public String getTransactionExpr() {
116 return (transactionExpr);
117 }
118
119 /***
120 * Setter method for "anchor" tag attribute. (Mapping set in associated
121 * BeanInfo class.)
122 */
123 public void setAnchorExpr(String anchorExpr) {
124 this.anchorExpr = anchorExpr;
125 }
126
127 /***
128 * Setter method for "forward" tag attribute. (Mapping set in associated
129 * BeanInfo class.)
130 */
131 public void setForwardExpr(String forwardExpr) {
132 this.forwardExpr = forwardExpr;
133 }
134
135 /***
136 * Setter method for "href" tag attribute. (Mapping set in associated
137 * BeanInfo class.)
138 */
139 public void setHrefExpr(String hrefExpr) {
140 this.hrefExpr = hrefExpr;
141 }
142
143 /***
144 * Setter method for "id" tag attribute. (Mapping set in associated
145 * BeanInfo class.)
146 */
147 public void setIdExpr(String idExpr) {
148 this.idExpr = idExpr;
149 }
150
151 /***
152 * Setter method for "page" tag attribute. (Mapping set in associated
153 * BeanInfo class.)
154 */
155 public void setPageExpr(String pageExpr) {
156 this.pageExpr = pageExpr;
157 }
158
159 /***
160 * Setter method for "transaction" tag attribute. (Mapping set in
161 * associated BeanInfo class.)
162 */
163 public void setTransactionExpr(String transactionExpr) {
164 this.transactionExpr = transactionExpr;
165 }
166
167 /***
168 * Resets attribute values for tag reuse.
169 */
170 public void release() {
171 super.release();
172 setAnchorExpr(null);
173 setForwardExpr(null);
174 setHrefExpr(null);
175 setIdExpr(null);
176 setPageExpr(null);
177 setTransactionExpr(null);
178 }
179
180 /***
181 * Process the start tag.
182 *
183 * @throws JspException if a JSP exception has occurred
184 */
185 public int doStartTag() throws JspException {
186 evaluateExpressions();
187
188 return (super.doStartTag());
189 }
190
191 /***
192 * Processes all attribute values which use the JSTL expression evaluation
193 * engine to determine their values.
194 *
195 * @throws JspException if a JSP exception has occurred
196 */
197 private void evaluateExpressions()
198 throws JspException {
199 String string = null;
200 Boolean bool = null;
201
202 if ((string =
203 EvalHelper.evalString("anchor", getAnchorExpr(), this,
204 pageContext)) != null) {
205 setAnchor(string);
206 }
207
208 if ((string =
209 EvalHelper.evalString("forward", getForwardExpr(), this,
210 pageContext)) != null) {
211 setForward(string);
212 }
213
214 if ((string =
215 EvalHelper.evalString("href", getHrefExpr(), this, pageContext)) != null) {
216 setHref(string);
217 }
218
219 if ((string =
220 EvalHelper.evalString("id", getIdExpr(), this, pageContext)) != null) {
221 setId(string);
222 }
223
224 if ((string =
225 EvalHelper.evalString("page", getPageExpr(), this, pageContext)) != null) {
226 setPage(string);
227 }
228
229 if ((bool =
230 EvalHelper.evalBoolean("transaction", getTransactionExpr(),
231 this, pageContext)) != null) {
232 setTransaction(bool.booleanValue());
233 }
234 }
235 }