Jon Stevens wrote: > > on 10/14/01 3:34 PM, "Bojan Smojver" <[EMAIL PROTECTED]> wrote: > > > Although I can see > > cases where there is a Float returned by Java and the View part of the > > application has to decide how it's going to be displayed. For instance, > > a balance of some sort can be displayed in red or black, depending on it > > sign (typical accounting scenario). > > This can be dealt with with a context object which analyzes the information > passed into it (ie: the float) and a #macro which handles the setting of the > color information. > > The analysis of the type of data in order to set the color is business logic > and does not belong in your templates.
Which would be something like: -------------------------------------- #set($isNegative = $toolKit.isNegative($theFloatBalance)) ... #if($isNegative) ... -------------------------------------- While, in case I was selling lollies (which are discrete values), and if I had to change to purple when my little customer is buying over, say 10, I could write: -------------------------------------- #if($theIntNumberOfLollies > 10) ... -------------------------------------- which is also a (kids) business logic thingy. Yes, I think I mentioned that some people don't agree with introduction of floating point numbers in Velocity ;-) Bojan PS. I don't want to reopen this debate, it just thought that we had no fun on this list for a while.
