Re: Freemarker builtins for sequences
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Tuesday, October 21, 2008, 8:56:22 PM, johnjohnmolina wrote:
> Hello all,
> I'm trying to read a sequence of ints (called errorList), to determine if a
> particlular value is contained in the sequence. If so, I would like to
> alter the style of a particular line of HTML in a table to be red.
>
> This is the code from the freemarker manual, I've based my code on:
> "blue": ${x?seq_contains("blue")?string("yes", "no")}
>
> I'm attempting to read errorList, to see if it contains the int 1,if so,
> upon generating the template, show this particular line in red (I'm doing
> some server side testing). Everything works ie. errorList is properly
> populated. This only partially works, it doesn't revert to default (ie.
> black), when 1 is removed from errorList.
>
> <td width="97%" <#if errorList?seq_contains(1)> style="color:red"</#if>>
> How long have you been a Y member? </td>
>
> Any help would be appreciated.
That line looks correct, so most probably the errorList still contains
1, that's why it remains red. Note that if you change something in the
data-model, you are expected to re-wrap it, i.e., in practice, call
Template.process(...) again, or else the internal (wrapped)
representation of the data-model may reflex the old state of the
data-model.
Another possibility is that the template output (the whole page most
probably) is cached somewhere outside FreeMarker. FreeMarker itself
doesn't cache output.
> Thanks,
> JS
>
--
Best regards,
Daniel Dekany
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/