I discovered that this can be achieved using a custom implementation of ColumnDecorator.
public class SuppressZeroDecorator implements DisplaytagColumnDecorator {
/* (non-Javadoc)
* @see org.displaytag.decorator.DisplaytagColumnDecorator#decorate(java.lang.Object, javax.servlet.jsp.PageContext, org.displaytag.properties.MediaTypeEnum)
*/
public Object decorate(Object rowObject, PageContext pageContext, MediaTypeEnum mediaType) {
if (rowObject != null && rowObject.toString().trim().equals("0")) {
return null;
}
return rowObject;
}
}
The decorator should be declared for each column in the JSP like this:
<display:column property="age" title="Age" decorator="com.example.ZeroColumnDecorator" />