com.ora.jsp.tags.generic
Class UsePropertyTag

java.lang.Object
  |
  +--javax.servlet.jsp.tagext.TagSupport
        |
        +--com.ora.jsp.tags.generic.UsePropertyTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class UsePropertyTag
extends javax.servlet.jsp.tagext.TagSupport

This class is a custom action for making a bean property value available to other actions and scripting code as a variable. The property must be a multi-value property. The getter method may take a String argument identifying the one value to return.

Version:
1.0
Author:
Hans Bergsten, Gefion software
See Also:
Serialized Form

Field Summary
private  java.lang.String arg
           
private  java.lang.String className
           
private  java.lang.String id
           
private  java.lang.String name
           
private  java.lang.String property
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
pageContext, parent, values
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
UsePropertyTag()
           
 
Method Summary
 int doEndTag()
          Retrieves one value of a multi-valued property in the specified bean using a getter method with a String argument.
private  java.lang.Object getProperty(java.lang.Object bean, java.lang.String property, java.lang.String propClassName)
          Returns the value of the specified property from the specified bean.
 void release()
          Releases all instance variables.
 void setArg(java.lang.String arg)
          Sets the arg attribute, i.e.
 void setClassName(java.lang.String className)
          Sets the class attribute, i.e.
 void setId(java.lang.String id)
          Sets the id attribute, i.e.
 void setName(java.lang.String name)
          Sets the name attribute, i.e.
 void setProperty(java.lang.String property)
          Sets the property attribute, i.e.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

id

private java.lang.String id

name

private java.lang.String name

property

private java.lang.String property

arg

private java.lang.String arg

className

private java.lang.String className
Constructor Detail

UsePropertyTag

public UsePropertyTag()
Method Detail

setId

public void setId(java.lang.String id)
Sets the id attribute, i.e. the name of the variable to hold the reference to the selected property value.
Overrides:
setId in class javax.servlet.jsp.tagext.TagSupport
Parameters:
id - the variable name

setName

public void setName(java.lang.String name)
Sets the name attribute, i.e. the name of the variable holding the reference to the bean with the property to retrieve.
Parameters:
name - the bean name

setProperty

public void setProperty(java.lang.String property)
Sets the property attribute, i.e. the name of the property to retrieve.
Parameters:
property - the property name

setArg

public void setArg(java.lang.String arg)
Sets the arg attribute, i.e. the String argument value used by the property getter method to select on of multiple property values.
Parameters:
arg - the String argument value

setClassName

public void setClassName(java.lang.String className)
Sets the class attribute, i.e. the class name for the property value.
Parameters:
className - the property class name

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Retrieves one value of a multi-valued property in the specified bean using a getter method with a String argument. The value is saved with the specified variable name in the page scope.
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport

release

public void release()
Releases all instance variables.
Overrides:
release in class javax.servlet.jsp.tagext.TagSupport

getProperty

private java.lang.Object getProperty(java.lang.Object bean,
                                     java.lang.String property,
                                     java.lang.String propClassName)
                              throws javax.servlet.jsp.JspException
Returns the value of the specified property from the specified bean.
Parameters:
bean - the bean
property - the property name
propertyClassName - the property class name (type)