* @throws IllegalAccessException
* @see javax.servlet.jsp.tagext.Tag#doStartTag()
*/
public int doStartTag() throws JspException
{
ParamAddable parent = (ParamAddable) JspUtils.getParent(this, ParamAddable.class);
if ((property != null) && (value != null))
{
final String message = "For one parameter" + name
+ "you can not use two values (first dynamic from the property, 2nd static from the value";
LOGGER.error(message);
throw new JspException(message);
}
if (name == null)
{
// use the same name as the name of property, if name is not
// specified
name = property;
}
if (property != null)
{
DefaultRowTag rowTag = (DefaultRowTag) JspUtils.getParent(this, DefaultRowTag.class);
Object bean = pageContext.getAttribute(rowTag.getBeanName());
if (bean != null && !(bean instanceof Spacer))
{
try
{
value = String.valueOf(PropertyUtils.getProperty(bean, property));
}
catch (Exception e)
{
LOGGER.error("<vlh:addParam> Error getting property '" + property + "'.");
value = null;
}
}
else
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Row's JavaBean '" + rowTag.getBeanName() + "' is null or Valuelist is empty!");
}
value = null;
}
}
if (value == null)
{
if (LOGGER.isInfoEnabled())
{
LOGGER.info("The param '" + addActionParamPrefix(name) + "' is skiped, because it's value is null!");
}
}
else
{
parent.addParam(addActionParamPrefix(name), value);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("The param '" + addActionParamPrefix(name) + "' was added with the value '" + value + "'.");
}
}