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.ResourceTag;
21 import org.apache.strutsel.taglib.utils.EvalHelper;
22
23 import javax.servlet.jsp.JspException;
24
25 /***
26 * Define a scripting variable based on the contents of the specified web
27 * application resource. <p> This class is a subclass of the class
28 * <code>org.apache.struts.taglib.bean.ResourceTag</code> which provides most
29 * of the described functionality. This subclass allows all attribute values
30 * to be specified as expressions utilizing the JavaServer Pages Standard
31 * Library expression language.
32 *
33 * @version $Rev: 376778 $
34 */
35 public class ELResourceTag extends ResourceTag {
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 "input" tag attribute. (Mapping set in
44 * associated BeanInfo class.)
45 */
46 private String inputExpr;
47
48 /***
49 * Instance variable mapped to "name" tag attribute. (Mapping set in
50 * associated BeanInfo class.)
51 */
52 private String nameExpr;
53
54 /***
55 * Getter method for "id" tag attribute. (Mapping set in associated
56 * BeanInfo class.)
57 */
58 public String getIdExpr() {
59 return (idExpr);
60 }
61
62 /***
63 * Getter method for "input" tag attribute. (Mapping set in associated
64 * BeanInfo class.)
65 */
66 public String getInputExpr() {
67 return (inputExpr);
68 }
69
70 /***
71 * Getter method for "name" tag attribute. (Mapping set in associated
72 * BeanInfo class.)
73 */
74 public String getNameExpr() {
75 return (nameExpr);
76 }
77
78 /***
79 * Setter method for "id" tag attribute. (Mapping set in associated
80 * BeanInfo class.)
81 */
82 public void setIdExpr(String idExpr) {
83 this.idExpr = idExpr;
84 }
85
86 /***
87 * Setter method for "input" tag attribute. (Mapping set in associated
88 * BeanInfo class.)
89 */
90 public void setInputExpr(String inputExpr) {
91 this.inputExpr = inputExpr;
92 }
93
94 /***
95 * Setter method for "name" tag attribute. (Mapping set in associated
96 * BeanInfo class.)
97 */
98 public void setNameExpr(String nameExpr) {
99 this.nameExpr = nameExpr;
100 }
101
102 /***
103 * Resets attribute values for tag reuse.
104 */
105 public void release() {
106 super.release();
107 setIdExpr(null);
108 setInputExpr(null);
109 setNameExpr(null);
110 }
111
112 /***
113 * Process the start tag.
114 *
115 * @throws JspException if a JSP exception has occurred
116 */
117 public int doStartTag() throws JspException {
118 evaluateExpressions();
119
120 return (super.doStartTag());
121 }
122
123 /***
124 * Processes all attribute values which use the JSTL expression evaluation
125 * engine to determine their values.
126 *
127 * @throws JspException if a JSP exception has occurred
128 */
129 private void evaluateExpressions()
130 throws JspException {
131 String string = null;
132
133 if ((string =
134 EvalHelper.evalString("id", getIdExpr(), this, pageContext)) != null) {
135 setId(string);
136 }
137
138 if ((string =
139 EvalHelper.evalString("input", getInputExpr(), this, pageContext)) != null) {
140 setInput(string);
141 }
142
143 if ((string =
144 EvalHelper.evalString("name", getNameExpr(), this, pageContext)) != null) {
145 setName(string);
146 }
147 }
148 }