1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.strutsel.taglib.tiles;
19
20 import org.apache.struts.tiles.taglib.ImportAttributeTag;
21 import org.apache.strutsel.taglib.utils.EvalHelper;
22
23 import javax.servlet.jsp.JspException;
24
25 /***
26 * Import attribute from component to requested scope. Attribute name and
27 * scope are optional. If not specified, all component attributes are imported
28 * in page scope. <p> This class is a subclass of the class
29 * <code>org.apache.struts.taglib.tiles.ImportAttributeTag</code> which
30 * provides most of the described functionality. This subclass allows all
31 * attribute values to be specified as expressions utilizing the JavaServer
32 * Pages Standard Library expression language.
33 *
34 * @version $Rev: 376781 $
35 */
36 public class ELImportAttributeTag extends ImportAttributeTag {
37 /***
38 * Instance variable mapped to "scope" tag attribute. (Mapping set in
39 * associated BeanInfo class.)
40 */
41 private String scopeExpr;
42
43 /***
44 * Instance variable mapped to "name" tag attribute. (Mapping set in
45 * associated BeanInfo class.)
46 */
47 private String nameExpr;
48
49 /***
50 * Instance variable mapped to "ignore" tag attribute. (Mapping set in
51 * associated BeanInfo class.)
52 */
53 private String ignoreExpr;
54
55 /***
56 * Getter method for "scope" tag attribute. (Mapping set in associated
57 * BeanInfo class.)
58 */
59 public String getScopeExpr() {
60 return (scopeExpr);
61 }
62
63 /***
64 * Getter method for "name" tag attribute. (Mapping set in associated
65 * BeanInfo class.)
66 */
67 public String getNameExpr() {
68 return (nameExpr);
69 }
70
71 /***
72 * Getter method for "ignore" tag attribute. (Mapping set in associated
73 * BeanInfo class.)
74 */
75 public String getIgnoreExpr() {
76 return (ignoreExpr);
77 }
78
79 /***
80 * Setter method for "scope" tag attribute. (Mapping set in associated
81 * BeanInfo class.)
82 */
83 public void setScopeExpr(String scopeExpr) {
84 this.scopeExpr = scopeExpr;
85 }
86
87 /***
88 * Setter method for "name" tag attribute. (Mapping set in associated
89 * BeanInfo class.)
90 */
91 public void setNameExpr(String nameExpr) {
92 this.nameExpr = nameExpr;
93 }
94
95 /***
96 * Setter method for "ignore" tag attribute. (Mapping set in associated
97 * BeanInfo class.)
98 */
99 public void setIgnoreExpr(String ignoreExpr) {
100 this.ignoreExpr = ignoreExpr;
101 }
102
103 /***
104 * Resets attribute values for tag reuse.
105 */
106 public void release() {
107 super.release();
108 setScopeExpr(null);
109 setNameExpr(null);
110 setIgnoreExpr(null);
111 }
112
113 /***
114 * Process the start tag.
115 *
116 * @throws JspException if a JSP exception has occurred
117 */
118 public int doStartTag() throws JspException {
119 evaluateExpressions();
120
121 return (super.doStartTag());
122 }
123
124 /***
125 * Processes all attribute values which use the JSTL expression evaluation
126 * engine to determine their values.
127 *
128 * @throws JspException if a JSP exception has occurred
129 */
130 private void evaluateExpressions()
131 throws JspException {
132 String string = null;
133 Boolean bool = null;
134
135 if ((string =
136 EvalHelper.evalString("scope", getScopeExpr(), this, pageContext)) != null) {
137 setScope(string);
138 }
139
140 if ((string =
141 EvalHelper.evalString("name", getNameExpr(), this, pageContext)) != null) {
142 setName(string);
143 }
144
145 if ((bool =
146 EvalHelper.evalBoolean("ignore", getIgnoreExpr(), this,
147 pageContext)) != null) {
148 setIgnore(bool.booleanValue());
149 }
150 }
151 }