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.InitDefinitionsTag;
24 import org.apache.strutsel.taglib.utils.EvalHelper;
25
26 import javax.servlet.jsp.JspException;
27
28 /**
29 * Init definitions factory. <p> This class is a subclass of the class
30 * <code>org.apache.struts.taglib.tiles.InitDefinitionsTag</code> which
31 * provides most of the described functionality. This subclass allows all
32 * attribute values to be specified as expressions utilizing the JavaServer
33 * Pages Standard Library expression language.
34 *
35 * @version $Rev: 471754 $
36 */
37 public class ELInitDefinitionsTag extends InitDefinitionsTag {
38 /**
39 * Instance variable mapped to "file" tag attribute. (Mapping set in
40 * associated BeanInfo class.)
41 */
42 private String fileExpr;
43
44 /**
45 * Instance variable mapped to "classname" tag attribute. (Mapping set in
46 * associated BeanInfo class.)
47 */
48 private String classnameExpr;
49
50 /**
51 * Getter method for "file" tag attribute. (Mapping set in associated
52 * BeanInfo class.)
53 */
54 public String getFileExpr() {
55 return (fileExpr);
56 }
57
58 /**
59 * Getter method for "classname" tag attribute. (Mapping set in associated
60 * BeanInfo class.)
61 */
62 public String getClassnameExpr() {
63 return (classnameExpr);
64 }
65
66 /**
67 * Setter method for "file" tag attribute. (Mapping set in associated
68 * BeanInfo class.)
69 */
70 public void setFileExpr(String fileExpr) {
71 this.fileExpr = fileExpr;
72 }
73
74 /**
75 * Setter method for "classname" tag attribute. (Mapping set in associated
76 * BeanInfo class.)
77 */
78 public void setClassnameExpr(String classnameExpr) {
79 this.classnameExpr = classnameExpr;
80 }
81
82 /**
83 * Resets attribute values for tag reuse.
84 */
85 public void release() {
86 super.release();
87 setFileExpr(null);
88 setClassnameExpr(null);
89 }
90
91 /**
92 * Process the start tag.
93 *
94 * @throws JspException if a JSP exception has occurred
95 */
96 public int doStartTag() throws JspException {
97 evaluateExpressions();
98
99 return (super.doStartTag());
100 }
101
102 /**
103 * Processes all attribute values which use the JSTL expression evaluation
104 * engine to determine their values.
105 *
106 * @throws JspException if a JSP exception has occurred
107 */
108 private void evaluateExpressions()
109 throws JspException {
110 String string = null;
111
112 if ((string =
113 EvalHelper.evalString("file", getFileExpr(), this, pageContext)) != null) {
114 setFile(string);
115 }
116
117 if ((string =
118 EvalHelper.evalString("classname", getClassnameExpr(), this,
119 pageContext)) != null) {
120 setClassname(string);
121 }
122 }
123 }