fmx:switch

Freemarker equivalent: https://freemarker.apache.org/docs/ref_directive_switch.html

fmx:switch only exists as a dedicated xml element. It essentially corresponds to the Freemarker code.

Options

Dedicated XML element

<fmx:switch fmx:value="model.type">
    <fmx:case fmx:value="'A'">
        <p>A</p>
    </fmx:case>
    <fmx:case fmx:value="'B'">
        <p>B</p>
    </fmx:case>
    <fmx:default>
      <p>DEFAULT</p>
    </fmx:default>
</fmx:switch>
[#switch model.type]
    [#case 'A']
        <p>A</p>
        [#break]
    [#case 'B']
        <p>B</p>
        [#break]
    [#defaut]
        <p>DEFAULT</p>
[/#switch]