StringValueTagpublic class StringValueTag extends ValueTag This class is a custom action intended to be used in the body of
a sqlQuery or an sqlUpdate action element. It adds the specified
value to its parent's value list. |
Fields Summary |
---|
private String | value | private String | prefix | private String | suffix |
Methods Summary |
---|
public int | doEndTag()Gets the value, specified by the value attribute, the stringValue
attribute, the param attribute, or the name and property attributes,
and adds it to the parent's value list.
if (param != null) {
value = getParameter(param);
}
else if (name != null) {
value = getString(name, property);
}
ValueTagParent parent =
(ValueTagParent) findAncestorWithClass(this, ValueTagParent.class);
if (parent == null) {
throw new JspException("The sqlStringValue action is not " +
"enclosed by a supported action type");
}
// Add prefix and suffix, of any
value = (prefix != null ? prefix : "") + value +
(suffix != null ? suffix : "");
parent.addValue(new StringValue(value));
return EVAL_PAGE;
| private java.lang.String | getString(java.lang.String beanName, java.lang.String propertyName)
String stringValue = null;
Object bean = getBean(beanName);
Method readMethod = getPropertyReadMethod(bean, propertyName);
Class returnType = readMethod.getReturnType();
Object value = getValue(bean, readMethod, propertyName);
if (String.class.isAssignableFrom(returnType)) {
stringValue = (String) value;
}
else {
throw new JspException("Read method for the " + propertyName +
" property in the bean named " + beanName + " is not of type " +
" String");
}
return stringValue;
| public void | release()Releases all instance variables.
value = null;
prefix = null;
suffix = null;
super.release();
| public void | setPrefix(java.lang.String prefix)Sets the prefix property.
this.prefix = prefix;
| public void | setSuffix(java.lang.String suffix)Sets the suffix property.
this.suffix = suffix;
| public void | setValue(java.lang.String value)Sets the value property.
this.value = value;
|
|