Discussion: FreeMarker Nested Expression Support (or lack thereof)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Discussion: FreeMarker Nested Expression Support (or lack thereof)

Adrian Crum-2
Currently, FreeMarker doesn't handle nested expressions very well. For example:

<#assign var1 = "this is var1"/>
<#assign var2 = "var1"/>
${${var2}}

should produce "this is var1" - but it throws an exception instead.

There is also a problem with handling expressions contained in a Map - as has been discussed recently regarding UI labels.

I spent most of the day today looking through the FreeMarker website and through their source code. I don't see an easy way to fix the problem.

Here are some options:

1. Leave a message for the FreeMarker folks and ask for better nested expression support.
2. Modify their source code to fix the problem, and keep our own version of the library (yuck).
3. Have FreeMarker render to a String, do our own expression expansions on the String, then output the result.

If anyone has any other options, please let me know.

Your thoughts and comments are welcome.

-Adrian



     
Reply | Threaded
Open this post in threaded view
|

Re: Discussion: FreeMarker Nested Expression Support (or lack thereof)

Adrian Crum-2
The expressions inside UI labels issue has been fixed in rev 674387.


--- On Fri, 7/4/08, Adrian Crum <[hidden email]> wrote:

> From: Adrian Crum <[hidden email]>
> Subject: Discussion: FreeMarker Nested Expression Support (or lack thereof)
> To: [hidden email]
> Date: Friday, July 4, 2008, 2:55 PM
> Currently, FreeMarker doesn't handle nested expressions
> very well. For example:
>
> <#assign var1 = "this is var1"/>
> <#assign var2 = "var1"/>
> ${${var2}}
>
> should produce "this is var1" - but it throws an
> exception instead.
>
> There is also a problem with handling expressions contained
> in a Map - as has been discussed recently regarding UI
> labels.
>
> I spent most of the day today looking through the
> FreeMarker website and through their source code. I
> don't see an easy way to fix the problem.
>
> Here are some options:
>
> 1. Leave a message for the FreeMarker folks and ask for
> better nested expression support.
> 2. Modify their source code to fix the problem, and keep
> our own version of the library (yuck).
> 3. Have FreeMarker render to a String, do our own
> expression expansions on the String, then output the
> result.
>
> If anyone has any other options, please let me know.
>
> Your thoughts and comments are welcome.
>
> -Adrian