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