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">&mdash;</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. 

velocity templates not substituting methods

try doing this:

#if (! $position.getcomment() || "$position.getcomment()" == "")     <td class="empty">&mdash;</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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -