java - Sometimes velocity does not substitute -
sometimes following code generates $position.getcomment()
in template. same other fields. occasional behavior. might reason , how fix?
#if($position.hascomment()) <td>$position.getcomment()</td> #else <td class="empty">—</td> #end
position's comment string , hascomment
following
public boolean hascomment() { return comment != null; }
some log might useful @ velocity startup
velocity - velocimacro : allowinline = true : vms can defined inline in templates velocity - velocimacro : allowinlinetooverride = false : vms defined inline may not replace previous vm definitions velocity - velocimacro : allowinlinelocal = false : vms defined inline global in scope if allowed.
try doing this:
#if (! $position.getcomment() || "$position.getcomment()" == "") <td class="empty">—</td> #else <td>$position.getcomment()</td> #end
i'm new on velocity, can't explain why, i've been programming 2 weeks html templates new project , on team we've found way best way it.
Comments
Post a Comment