/*
* writeDocumentPropertyTimes.java
*
* Created on 1 de Abril de 2003, 20:36
*/
package jomm.web.tags;
/**
*
* @author Jorge Machado
*/
import org.apache.log4j.Logger;
import org.apache.struts.util.RequestUtils;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;
public class NotEqualBeansTag
extends BodyTagSupport
{
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(NotEqualBeansTag.
class);
/**
* Name of the bean that contains the data we will be rendering.
*/
protected 1.5.0/docs/api/java/lang/String.html">String name1 =
null;
public 1.5.0/docs/api/java/lang/String.html">String getName1
() {
return (this.
name1);
}
public void setName1
(1.5.0/docs/api/java/lang/String.html">String name1
) {
this.
name1 = name1
;
}
/**
* Name of the bean that contains the data we will be rendering.
*/
protected 1.5.0/docs/api/java/lang/String.html">String name2 =
null;
public 1.5.0/docs/api/java/lang/String.html">String getName2
() {
return (this.
name2);
}
public void setName2
(1.5.0/docs/api/java/lang/String.html">String name2
) {
this.
name2= name2
;
}
/**
* Name of the property to be accessed on the specified bean.
*/
protected 1.5.0/docs/api/java/lang/String.html">String property1 =
null;
public 1.5.0/docs/api/java/lang/String.html">String getProperty1
() {
return (this.
property1);
}
public void setProperty1
(1.5.0/docs/api/java/lang/String.html">String property1
) {
this.
property1 = property1
;
}
/**
* Name of the property to be accessed on the specified bean.
*/
protected 1.5.0/docs/api/java/lang/String.html">String property2 =
null;
public 1.5.0/docs/api/java/lang/String.html">String getProperty2
() {
return (this.
property2);
}
public void setProperty2
(1.5.0/docs/api/java/lang/String.html">String property2
) {
this.
property2 = property2
;
}
/**
* The scope to be searched to retrieve the specified bean.
*/
protected 1.5.0/docs/api/java/lang/String.html">String scope =
null;
public 1.5.0/docs/api/java/lang/String.html">String getScope
() {
return (this.
scope);
}
public void setScope
(1.5.0/docs/api/java/lang/String.html">String scope
) {
this.
scope = scope
;
}
public int doStartTag
() throws JspException
{
// Look up the requested bean (if necessary)
5+0%2Fdocs%2Fapi+Object">Object bean =
null;
// Look up the requested property value
5+0%2Fdocs%2Fapi+Object">Object value1 =
RequestUtils.
lookup(pageContext, name1, property1,
null);
5+0%2Fdocs%2Fapi+Object">Object value2 =
RequestUtils.
lookup(pageContext, name2, property2,
null);
if (value1 ==
null || value2 ==
null)
return SKIP_BODY
;
if(!value1.
equals(value2
))
{
return EVAL_BODY_TAG
;
}
return SKIP_BODY
;
}
public int doEndTag
() throws JspException
{
// Look up the requested bean (if necessary)
5+0%2Fdocs%2Fapi+Object">Object bean =
null;
// Look up the requested property value
5+0%2Fdocs%2Fapi+Object">Object value1 =
RequestUtils.
lookup(pageContext, name1, property1,
null);
5+0%2Fdocs%2Fapi+Object">Object value2 =
RequestUtils.
lookup(pageContext, name2, property2,
null);
if (value1 ==
null || value2 ==
null)
return SKIP_BODY
;
if(!value1.
equals(value2
) && bodyContent
!=
null)
{
1.5.0/docs/api/java/lang/String.html">String toPage = bodyContent.
getString().
trim();
JspWriter writer = pageContext.
getOut();
try{
writer.
write(toPage
);
}
catch(1.5.0/docs/api/java/lang/Exception.html">Exception e
)
{
logger.
error(e,e
);
throw new JspException
(e
);
}
}
// Continue processing this page
return EVAL_PAGE
;
}
}