Re: Concatenation with assign operator

Daniel Dekany <[email protected]> Sat, 13 Jul 2013 10:14:36 +0200
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Friday, July 12, 2013, 11:33:54 PM, anjibman wrote:

> Hi All,
>
> What will be easy way to do this in freemarker
>
> if(someValue == null) {
>      result = loc1Path + defaultValue;
> }
> else {
>    result = loc2Path + someValue;
> }
>
> I can have like this free marker 
>
> <#assign result = someValue ! defaultValue/>
>
> but did't find a easy way to concatenate path.

If indeed both sides of the "+" changes depending on if someValue
exists, then:

  (loc2Path + someValue)!(loc1Path + defaultValue)

If the locPath part is always the same:

  locPath + (someValue!defaultValue)

> Any suggestion?
>
>
>
>
> --
> View this message in context:
> http://freemarker.624813.n4.nabble.com/Concatenation-with-assign-operator-tp4654636.html
> Sent from the freemarker-user mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>

-- 
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk