FileDocCategorySizeDatePackage
ValueTag.javaAPI DocExample4897Thu Jun 28 16:14:16 BST 2001com.ora.jsp.tags.sql.value

ValueTag

public class ValueTag extends TagSupport
This class is a superclass for custom action classes intended to be used in the body of a sqlQuery or an sqlUpdate action element. It provides methods for dealing with common attributes.
author
Hans Bergsten, Gefion software
version
1.0

Fields Summary
protected String
stringValue
protected String
pattern
protected String
param
protected String
name
protected String
property
Constructors Summary
Methods Summary
protected java.lang.ObjectgetBean(java.lang.String beanName)
Returns the value of the specified bean, or throws a JspException if it doesn't exist.

        Object bean = pageContext.findAttribute(beanName);
        if (bean == null) {
            throw new JspException("Bean named " + beanName + " not found");
        }
        return bean;
    
protected java.lang.StringgetParameter(java.lang.String paramName)
Returns the value of the specified request parameter, or throws a JspException if it doesn't exist.

        ServletRequest request = pageContext.getRequest();
        String value = request.getParameter(paramName);
        if (value == null) {
            throw new JspException("Parameter " + paramName + " not found");
        }
        return value;
    
protected java.lang.reflect.MethodgetPropertyReadMethod(java.lang.Object bean, java.lang.String propertyName)
Returns the read access method for the specified property of the specified bean, or throws a JspException if it doesn't exist.

        Method readMethod = null;
        BeanInfo beanInfo = null;
        try {
            beanInfo = Introspector.getBeanInfo(bean.getClass());
        }
        catch (IntrospectionException e) {
            throw new JspException("Exception trying to locate the " + propertyName +
                " property in the bean class " + bean.getClass() + ": " +
                e.getMessage());
        }
        PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
        for (int i = 0; pds != null && i < pds.length; i++) {
            if (pds[i].getName().equals(propertyName)) {
                readMethod = pds[i].getReadMethod();
                break;
            }
        }
        if (readMethod == null) {
            throw new JspException("Read method for the " + propertyName +
                " property in the bean class " + bean.getClass() + " not found");
        }
        return readMethod;
    
protected java.lang.ObjectgetValue(java.lang.Object bean, java.lang.reflect.Method readMethod, java.lang.String propertyName)
Invokes the read access method on the specified bean and returns the result, or throws a JspException if it fails.

        Object value = null;
        try {
            value = readMethod.invoke(bean, null);
        }
        catch (InvocationTargetException ite) {
            throw new JspException("Exception trying to read the " + propertyName +
                " property in the bean class " + bean.getClass() + ": " +
                ite.getMessage());
        }
        catch (IllegalAccessException iae) {
            throw new JspException("Exception trying to read the " + propertyName +
                " property in the bean class " + bean.getClass() + ": " +
                iae.getMessage());
        }
        return value;
    
public voidrelease()
Releases all instance variables.

        stringValue = null;
        pattern = null;
        param = null;
        name = null;
        property = null;
        super.release();
    
public voidsetName(java.lang.String name)
Sets the name of the bean in one of the JSP scopes with a property that holds the value.

        this.name = name;
    
public voidsetParam(java.lang.String param)
Sets the name of the HTTP parameter that holds the value.

        this.param = param;
    
public voidsetPattern(java.lang.String pattern)
Sets the parsing pattern for a date/time or a numeric value expressed as a String.

        this.pattern = pattern;
    
public voidsetProperty(java.lang.String property)
Sets the name of the bean property that holds the value.

        this.property = property;
    
public voidsetStringValue(java.lang.String stringValue)
Sets the value as a String.

        this.stringValue = stringValue;