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