Subversion Repositories bacoAlunos

Rev

Rev 1306 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 fvelez 1
/*
2
 * writeDocumentPropertyTimes.java
3
 *
4
 * Created on 1 de Abril de 2003, 20:36
5
 */
6
 
7
package jomm.web.tags;
8
 
9
/**
10
 *
11
 * @author  Jorge Machado
12
 */
13
 
14
import org.apache.log4j.Logger;
15
import org.apache.struts.util.RequestUtils;
16
 
17
import javax.servlet.jsp.JspException;
18
import javax.servlet.jsp.JspWriter;
19
import javax.servlet.jsp.tagext.BodyTagSupport;
20
 
21
public class EqualBeansTag extends BodyTagSupport{
22
 
23
    private static 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(EqualBeansTag.class);
24
 
25
 
26
 
27
    /**
28
     * Name of the bean that contains the data we will be rendering.
29
     */
30
    protected 1.5.0/docs/api/java/lang/String.html">String name1 = null;
31
 
32
    public 1.5.0/docs/api/java/lang/String.html">String getName1() {
33
        return (this.name1);
34
    }
35
 
36
    public void setName1(1.5.0/docs/api/java/lang/String.html">String name1) {
37
        this.name1 = name1;
38
    }
39
 
40
    /**
41
     * Name of the bean that contains the data we will be rendering.
42
     */
43
    protected 1.5.0/docs/api/java/lang/String.html">String name2 = null;
44
 
45
    public 1.5.0/docs/api/java/lang/String.html">String getName2() {
46
        return (this.name2);
47
    }
48
 
49
    public void setName2(1.5.0/docs/api/java/lang/String.html">String name2) {
50
        this.name2= name2;
51
    }
52
    /**
53
     * Name of the property to be accessed on the specified bean.
54
     */
55
    protected 1.5.0/docs/api/java/lang/String.html">String property1 = null;
56
 
57
    public 1.5.0/docs/api/java/lang/String.html">String getProperty1() {
58
        return (this.property1);
59
    }
60
 
61
    public void setProperty1(1.5.0/docs/api/java/lang/String.html">String property1) {
62
        this.property1 = property1;
63
    }
64
 
65
    /**
66
     * Name of the property to be accessed on the specified bean.
67
     */
68
    protected 1.5.0/docs/api/java/lang/String.html">String property2 = null;
69
 
70
    public 1.5.0/docs/api/java/lang/String.html">String getProperty2() {
71
        return (this.property2);
72
    }
73
 
74
    public void setProperty2(1.5.0/docs/api/java/lang/String.html">String property2) {
75
        this.property2 = property2;
76
    }
77
 
78
 
79
    /**
80
     * The scope to be searched to retrieve the specified bean.
81
     */
82
    protected 1.5.0/docs/api/java/lang/String.html">String scope = null;
83
 
84
    public 1.5.0/docs/api/java/lang/String.html">String getScope() {
85
        return (this.scope);
86
    }
87
 
88
    public void setScope(1.5.0/docs/api/java/lang/String.html">String scope)
89
    {
90
        this.scope = scope;
91
    }
92
 
93
 
94
    public int doStartTag() throws JspException
95
    {
96
        return EVAL_BODY_TAG;
97
    }
98
    public int doEndTag() throws JspException {
99
 
100
        // Look up the requested bean (if necessary)
101
        5+0%2Fdocs%2Fapi+Object">Object bean = null;
102
 
103
        // Look up the requested property value
104
        5+0%2Fdocs%2Fapi+Object">Object value1 =
105
                RequestUtils.lookup(pageContext, name1, property1, null);
106
        5+0%2Fdocs%2Fapi+Object">Object value2 =
107
                RequestUtils.lookup(pageContext, name2, property2, null);
108
 
109
 
110
        if (value1 == null || value2 == null){
111
            return EVAL_PAGE;
112
        }
113
 
114
 
115
        if(value1.equals(value2) && bodyContent != null)
116
        {
117
            1.5.0/docs/api/java/lang/String.html">String toPage = bodyContent.getString().trim();
118
            JspWriter writer = pageContext.getOut();
119
            try
120
            {
121
                writer.write(toPage);
122
            }
123
            catch(1.5.0/docs/api/java/lang/Exception.html">Exception e)
124
            {
125
                logger.error(e,e);
126
                throw new JspException(e);
127
            }
128
        }
129
 
130
        // Continue processing this page
131
        return EVAL_PAGE;
132
    }
133
 
134
 
135
}