~ubuntu-branches/ubuntu/trusty/libstruts1.2-java/trusty-proposed

« back to all changes in this revision

Viewing changes to contrib/struts-el/src/share/org/apache/strutsel/taglib/bean/ELStrutsTag.java

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2004-11-19 15:35:25 UTC
  • Revision ID: james.westby@ubuntu.com-20041119153525-mdu08a76z4zo67xt
Tags: upstream-1.2.4
ImportĀ upstreamĀ versionĀ 1.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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 $
 
3
 * $Revision: 1.8 $
 
4
 * $Date: 2004/03/14 07:15:04 $
 
5
 *
 
6
 * Copyright 1999-2004 The Apache Software Foundation.
 
7
 * 
 
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
 
11
 * 
 
12
 *      http://www.apache.org/licenses/LICENSE-2.0
 
13
 * 
 
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.
 
19
 */
 
20
 
 
21
package org.apache.strutsel.taglib.bean;
 
22
 
 
23
import org.apache.struts.taglib.bean.StrutsTag;
 
24
import javax.servlet.jsp.JspException;
 
25
import org.apache.strutsel.taglib.utils.EvalHelper;
 
26
 
 
27
/**
 
28
 * Define a scripting variable that exposes the requested Struts
 
29
 * internal configuraton object.
 
30
 *<p>
 
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.
 
36
 *
 
37
 * @version $Revision: 1.8 $
 
38
 */
 
39
public class ELStrutsTag extends StrutsTag {
 
40
 
 
41
    /**
 
42
     * Instance variable mapped to "id" tag attribute.
 
43
     * (Mapping set in associated BeanInfo class.)
 
44
     */
 
45
    private String idExpr;
 
46
    /**
 
47
     * Instance variable mapped to "formBean" tag attribute.
 
48
     * (Mapping set in associated BeanInfo class.)
 
49
     */
 
50
    private String formBeanExpr;
 
51
    /**
 
52
     * Instance variable mapped to "forward" tag attribute.
 
53
     * (Mapping set in associated BeanInfo class.)
 
54
     */
 
55
    private String forwardExpr;
 
56
    /**
 
57
     * Instance variable mapped to "mapping" tag attribute.
 
58
     * (Mapping set in associated BeanInfo class.)
 
59
     */
 
60
    private String mappingExpr;
 
61
 
 
62
    /**
 
63
     * Getter method for "id" tag attribute.
 
64
     * (Mapping set in associated BeanInfo class.)
 
65
     */
 
66
    public String getIdExpr() { return (idExpr); }
 
67
    /**
 
68
     * Getter method for "formBean" tag attribute.
 
69
     * (Mapping set in associated BeanInfo class.)
 
70
     */
 
71
    public String getFormBeanExpr() { return (formBeanExpr); }
 
72
    /**
 
73
     * Getter method for "forward" tag attribute.
 
74
     * (Mapping set in associated BeanInfo class.)
 
75
     */
 
76
    public String getForwardExpr() { return (forwardExpr); }
 
77
    /**
 
78
     * Getter method for "mapping" tag attribute.
 
79
     * (Mapping set in associated BeanInfo class.)
 
80
     */
 
81
    public String getMappingExpr() { return (mappingExpr); }
 
82
 
 
83
    /**
 
84
     * Setter method for "id" tag attribute.
 
85
     * (Mapping set in associated BeanInfo class.)
 
86
     */
 
87
    public void setIdExpr(String idExpr) { this.idExpr = idExpr; }
 
88
    /**
 
89
     * Setter method for "formBean" tag attribute.
 
90
     * (Mapping set in associated BeanInfo class.)
 
91
     */
 
92
    public void setFormBeanExpr(String formBeanExpr) { this.formBeanExpr = formBeanExpr; }
 
93
    /**
 
94
     * Setter method for "forward" tag attribute.
 
95
     * (Mapping set in associated BeanInfo class.)
 
96
     */
 
97
    public void setForwardExpr(String forwardExpr) { this.forwardExpr = forwardExpr; }
 
98
    /**
 
99
     * Setter method for "mapping" tag attribute.
 
100
     * (Mapping set in associated BeanInfo class.)
 
101
     */
 
102
    public void setMappingExpr(String mappingExpr) { this.mappingExpr = mappingExpr; }
 
103
 
 
104
    /**
 
105
     * Resets attribute values for tag reuse.
 
106
     */
 
107
    public void release()
 
108
    {
 
109
        super.release();
 
110
        setIdExpr(null);
 
111
        setFormBeanExpr(null);
 
112
        setForwardExpr(null);
 
113
        setMappingExpr(null);
 
114
    }
 
115
    
 
116
    /**
 
117
     * Process the start tag.
 
118
     *
 
119
     * @exception JspException if a JSP exception has occurred
 
120
     */
 
121
    public int doStartTag() throws JspException {
 
122
        evaluateExpressions();
 
123
        return (super.doStartTag());
 
124
    }
 
125
 
 
126
    /**
 
127
     * Processes all attribute values which use the JSTL expression evaluation
 
128
     * engine to determine their values.
 
129
     *
 
130
     * @exception JspException if a JSP exception has occurred
 
131
     */
 
132
    private void evaluateExpressions() throws JspException {
 
133
        String  string  = null;
 
134
 
 
135
        if ((string = EvalHelper.evalString("id", getIdExpr(),
 
136
                                            this, pageContext)) != null)
 
137
            setId(string);
 
138
 
 
139
        if ((string = EvalHelper.evalString("formBean", getFormBeanExpr(),
 
140
                                            this, pageContext)) != null)
 
141
            setFormBean(string);
 
142
 
 
143
        if ((string = EvalHelper.evalString("forward", getForwardExpr(),
 
144
                                            this, pageContext)) != null)
 
145
            setForward(string);
 
146
 
 
147
        if ((string = EvalHelper.evalString("mapping", getMappingExpr(),
 
148
                                            this, pageContext)) != null)
 
149
            setMapping(string);
 
150
    }
 
151
}