2
* $Header: /home/cvs/jakarta-struts/contrib/struts-el/src/share/org/apache/strutsel/taglib/bean/ELStrutsTag.java,v 1.8 2004/03/14 07:15:04 sraeburn Exp $
4
* $Date: 2004/03/14 07:15:04 $
6
* Copyright 1999-2004 The Apache Software Foundation.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
12
* http://www.apache.org/licenses/LICENSE-2.0
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
21
package org.apache.strutsel.taglib.bean;
23
import org.apache.struts.taglib.bean.StrutsTag;
24
import javax.servlet.jsp.JspException;
25
import org.apache.strutsel.taglib.utils.EvalHelper;
28
* Define a scripting variable that exposes the requested Struts
29
* internal configuraton object.
31
* This class is a subclass of the class
32
* <code>org.apache.struts.taglib.bean.StrutsTag</code> which provides most of
33
* the described functionality. This subclass allows all attribute values to
34
* be specified as expressions utilizing the JavaServer Pages Standard Library
35
* expression language.
37
* @version $Revision: 1.8 $
39
public class ELStrutsTag extends StrutsTag {
42
* Instance variable mapped to "id" tag attribute.
43
* (Mapping set in associated BeanInfo class.)
45
private String idExpr;
47
* Instance variable mapped to "formBean" tag attribute.
48
* (Mapping set in associated BeanInfo class.)
50
private String formBeanExpr;
52
* Instance variable mapped to "forward" tag attribute.
53
* (Mapping set in associated BeanInfo class.)
55
private String forwardExpr;
57
* Instance variable mapped to "mapping" tag attribute.
58
* (Mapping set in associated BeanInfo class.)
60
private String mappingExpr;
63
* Getter method for "id" tag attribute.
64
* (Mapping set in associated BeanInfo class.)
66
public String getIdExpr() { return (idExpr); }
68
* Getter method for "formBean" tag attribute.
69
* (Mapping set in associated BeanInfo class.)
71
public String getFormBeanExpr() { return (formBeanExpr); }
73
* Getter method for "forward" tag attribute.
74
* (Mapping set in associated BeanInfo class.)
76
public String getForwardExpr() { return (forwardExpr); }
78
* Getter method for "mapping" tag attribute.
79
* (Mapping set in associated BeanInfo class.)
81
public String getMappingExpr() { return (mappingExpr); }
84
* Setter method for "id" tag attribute.
85
* (Mapping set in associated BeanInfo class.)
87
public void setIdExpr(String idExpr) { this.idExpr = idExpr; }
89
* Setter method for "formBean" tag attribute.
90
* (Mapping set in associated BeanInfo class.)
92
public void setFormBeanExpr(String formBeanExpr) { this.formBeanExpr = formBeanExpr; }
94
* Setter method for "forward" tag attribute.
95
* (Mapping set in associated BeanInfo class.)
97
public void setForwardExpr(String forwardExpr) { this.forwardExpr = forwardExpr; }
99
* Setter method for "mapping" tag attribute.
100
* (Mapping set in associated BeanInfo class.)
102
public void setMappingExpr(String mappingExpr) { this.mappingExpr = mappingExpr; }
105
* Resets attribute values for tag reuse.
107
public void release()
111
setFormBeanExpr(null);
112
setForwardExpr(null);
113
setMappingExpr(null);
117
* Process the start tag.
119
* @exception JspException if a JSP exception has occurred
121
public int doStartTag() throws JspException {
122
evaluateExpressions();
123
return (super.doStartTag());
127
* Processes all attribute values which use the JSTL expression evaluation
128
* engine to determine their values.
130
* @exception JspException if a JSP exception has occurred
132
private void evaluateExpressions() throws JspException {
133
String string = null;
135
if ((string = EvalHelper.evalString("id", getIdExpr(),
136
this, pageContext)) != null)
139
if ((string = EvalHelper.evalString("formBean", getFormBeanExpr(),
140
this, pageContext)) != null)
143
if ((string = EvalHelper.evalString("forward", getForwardExpr(),
144
this, pageContext)) != null)
147
if ((string = EvalHelper.evalString("mapping", getMappingExpr(),
148
this, pageContext)) != null)