Este es el código de la clase decorator:
Código PHP:
public class ImageColumnDecorator implements DisplaytagColumnDecorator{
public Object decorate(Object columnValue, PageContext pageContext,MediaTypeEnum media) throws DecoratorException
{
String imagePath = (String) columnValue;
StringBuffer sb = new StringBuffer();
sb.append("<img width='100' height='100' src=\"" + imagePath + "\">");
return sb.toString();
}
}
Código PHP:
public class ImageColumnDecorator implements DisplaytagColumnDecorator{
public Object decorate(Object columnValue, PageContext pageContext,MediaTypeEnum media) throws DecoratorException
{
String imagePath = (String) columnValue;
StringBuffer sb = new StringBuffer();
if (imagePath.equals(""))
{
imagePath="./img/noimagen.jpg";
sb.append("<img width='100' height='100' src=\"" + imagePath + "\">");
}
else
sb.append("<img width='100' height='100' src=\"" + imagePath + "\">");
return sb.toString();
}
}