Methods Summary |
---|
protected java.lang.Object | getBean(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.String | getParameter(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.Method | getPropertyReadMethod(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.Object | getValue(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 void | release()Releases all instance variables.
stringValue = null;
pattern = null;
param = null;
name = null;
property = null;
super.release();
|
public void | setName(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 void | setParam(java.lang.String param)Sets the name of the HTTP parameter that holds
the value.
this.param = param;
|
public void | setPattern(java.lang.String pattern)Sets the parsing pattern for a date/time or a
numeric value expressed as a String.
this.pattern = pattern;
|
public void | setProperty(java.lang.String property)Sets the name of the bean property that holds the
value.
this.property = property;
|
public void | setStringValue(java.lang.String stringValue)Sets the value as a String.
this.stringValue = stringValue;
|