How to use setBooleanFormat method in freemarker.template.Configuration

Best java code snippets using freemarker.template . configuration . setbooleanformat (showing top 7 results out of 315).

Built-ins for booleans

Page Contents

c (when used with boolean)

String (when used with a boolean value).

This built-in exists since FreeMarker 2.3.20.

This built-in converts a boolean to string for a "computer language" as opposed to for human audience. The result will be "true" or "false" , regardless of the boolean_format setting. When generating JavaScript and such, this should be used, as otherwise changing the boolean_format can break the generated computer-language output.

Note that this built-in also works on strings .

Converts a boolean to a string. You can use it in two ways:

As foo?string("yes", "no") : This will return the first parameter (here: "yes" ) if the boolean is true, otherwise the second parameter (here: "no" ). Note that the return value is always a string; if the parameters were numbers, they would be converted to strings first.

foo?string : Deprecated starting from FreeMarker 2.3.20: use ?c instead, or set the boolean_format setting to something like "yes,no" and then the conversion can happen automatically . If you still need to know about this, this will convert the boolean to string using the default strings for representing true and false values. By default, true is rendered as "true" and false is rendered as "false" . This is mostly useful if you generate source code with FreeMarker (but use ?c for that starting from 2.3.20) , since the values are not locale (language, country) sensitive. To change these default strings, you can use the boolean_format setting .

Note, that in the very rare case when a value is multi-typed and is both a boolean and a string, then the string value of the variable will be returned, and so the boolean_format setting will have no effect.

Search code, repositories, users, issues, pull requests...

Provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

Minecraft Java & Bedrock Edition key art

Play Minecraft Games with Game Pass

freemarker set boolean_format

ALSO AVAILABLE ON:

Minecraft is available to play on the following platforms:

freemarker set boolean_format

*Mac and Linux are compatible with Java Edition only.

Noor, holding an Armadillo Scute, is fighting a Ravager in a Savanna Village alongside their pet Wolf, which is wearing green-dyed Wolf Armor.

Minecraft Snapshot 24w09a

A Minecraft Java Snapshot

Hello! Here is a slightly bigger than usual snapshot with a lot of technical changes, refreshed UI, another iteration of Wolf Armor, and tweaks to new features.

Since the initial release of the Wolf Armor, we have been working on improving it to increase its protection, usability and add customization. For protection there is a new approach to armor, which considers the player's need to quickly see the state of the armor without using UI elements, and the ability to act quickly to help their pet wolf if needed. Please try it out and let us know what you think over at the feedback site: Let's talk about Wolf Armor!

Experimental Features

  • The Bogged drops 2 mushrooms (either both red/brown or one of each) when sheared
  • Updated Bogged texture and model

Wind Charge

  • Removed randomness from the radius of both Breeze- and player-shot Wind Charges
  • Additional changes to the Vault texture to even further distinguish from Trial Spawners
  • Changes to Wolf Armor
  • The game's UI has been updated with a fresher look
  • Ctrl+Picking a renamed block (such as a Chest) in Creative Mode will now give a renamed item
  • The Wolf Armor will protect the wolf from most damage sources until the armor loses all durability and breaks
  • Wolf Armor shows signs of increased breakage as durability goes down
  • Players can repair the Wolf Armor with Armadillo Scutes while it is equipped on the Wolf
  • Wolf armor can be dyed in similar fashion to Leather Armor
  • The Wolf's owner can now repair Wolf Armor on a Wolf

The UI has been updated to sport a fresher look and to be more consistent when it comes to the layout of different UI elements, all while retaining the essence and feel of the old screens.

As always, we're eager to hear your thoughts and opinions on further improvements or changes. Let us know what you think over at the dedicated feedback site .

  • The dirt texture has been moved to the build-in Programmer Art Resource Pack
  • Outside the game, the menu Panorama is displayed across all screen
  • In the game, the world will be visible across all screens
  • The strength of the blur can be configured in Accessibility Settings
  • In-game screens such as containers and books are not affected by these changes
  • Screen elements such as titles and buttons are positioned more consistently across different screens
  • The Player and World Backups screens in Realms have been updated
  • Lists now have clearer borders at the top and bottom
  • After defeating the Ender Dragon and entering the End Portal, the End Poem and credits are now displayed with a background based on the animated End Portal effect

Technical Changes

  • The Data Pack version is now 33
  • The Resource Pack version is now 28
  • playsound command can now be used without specifying the player (assuming @s ) and without specifying the mixer (assuming master )
  • In single player, when errors occur during loading or saving of chunks a warning will be shown in a toast
  • Additionally, a warning toast will be shown periodically while in game

Data Pack Version 33

  • Added minecraft:bypasses_wolf_armor for damage sources that can not be absorbed by Wolf Armor
  • Loot table entry with id loot_table now also accepts inline loot tables
  • Unstructured NBT data attached to stacks of items ( tag field) has been replaced with structured 'components'

Loot Tables

Loot table entry loot_table (which returns all items from provided nested loot table) now has the following syntax:

  • namespaced id - reference to another named loot table
  • full loot table (same format as in standalone file)

Item Stack Components

We are making some large changes to how Item Stack-specific properties are stored and represented in this snapshot, replacing the current NBT 'tag' with structured components.

This change has been made in order to:

  • Improve performance in cases where the game needs to frequently look up some property of an item (e.g. Armor Trims rendering every frame)
  • This should avoid any 'silent' breakages in commands specifying custom item data for any potential future format changes
  • Continue to evolve the game to enable the creation of dynamic content

We understand that this is a significant breaking change for many datapacks and custom maps which will require significant effort to upgrade.

We do however believe that this builds critical foundations for future extensibility. We have taken care to ship these changes all at once, with the hope that this avoids future incremental changes requiring many small updates to packs.

The current NBT 'tag' has existed for quite some time, and we are aware that a lot of clever techniques have been developed with this for commands and data packs.

Although we have made our best effort to identify these cases, some of these techniques rely on undocumented or undefined behavior with certain tag configurations.

We want to ensure that no functionality is lost without a suitable alternative, but due to the undocumented nature of these techniques, we have very likely not caught everything!

We hope to address any regressions over the remaining course of this snapshot cycle.

With such a large change, we deeply value your feedback! You can share your thoughts on these changes over at the feedback site: Let's talk about Item Stack Components! .

  • This data is parsed and validated when the item is loaded
  • This should improve performance in certain scenarios (e.g. Armor Trim rendering) when item data was frequently compared or requested and parsed
  • Custom data can still be stored in the minecraft:custom_data component
  • Item types (e.g. minecraft:stick ) hold a set of default components on an item that individual item stacks can override
  • The format of serialized items and items in data packs has been updated for consistency and to support components
  • Item syntax in commands has been updated to support components
  • When advanced tooltips are enabled (F3+H), the number of components will be displayed instead of number of tags
  • Default component values for items are now listed in items.json generated in reports directory
  • The ignoreTags field on villager trades has been removed and replaced by a component predicate on damage
  • Block definitions are now added to blocks.json report (note: those definitions are not used yet and present only for informational purposes)
  • If the key_item field of Vault block is not present, the Vault cannot be unlocked

minecraft:custom_data

  • Can be used for custom data storage on an item
  • In predicates (e.g. /clear ), will be partially matched as currently
  • When upgrading a world, any non-game data in the item tag will be moved into here
  • e.g. custom_data={some:'data'}

minecraft:damage

  • The amount of durability removed from an item
  • If removed, the item will not be damageable
  • Replaces Damage tag
  • e.g. damage=12
  • For damageable items, has an implicit default value of: 0

minecraft:repair_cost

  • The additional experience cost required to modify an item in an Anvil
  • Replaces RepairCost tag
  • e.g. repair_cost=12
  • If not set, has an implicit default value of: 0

minecraft:unbreakable

  • If set, the item will not lose any durability when used
  • Replaces Unbreakable boolean tag
  • If true , an 'Unbreakable' line will be included in the tooltip
  • Replaces 3rd bit of HideFlags tag
  • e.g. unbreakable={} , unbreakable={show_in_tooltip:false}

minecraft:enchantments

  • Stores a list of enchantments and their levels on an item
  • Replaces Enchantments tag
  • levels : object of enchantment (id string) to level (integer [0; 255])
  • If false , no enchantments will be shown in the item tooltip
  • Replaces 1st bit of HideFlags tag
  • e.g. enchantments={levels:{'minecraft:protection':2},show_in_tooltip:false}
  • If not set, has an implicit default value of: {levels:{}}

minecraft:stored_enchantments

  • Stores list of enchantments and their levels for an Enchanted Book
  • The effects provided by enchantments do not apply from this component
  • Replaces StoredEnchantments tag on Enchanted Books
  • show_in_tooltip value replaces 6th bit of HideFlags tag
  • On Enchanted Books, has an implicit default value of: {levels:{}}

minecraft:custom_name

  • Custom name override for an item
  • Replaces display.Name tag
  • e.g. custom_name='{"text": "This item is renamed!", "color": "red"}'

minecraft:lore

  • Additional lines to include in an item's tooltip
  • Replaces display.Lore tag
  • e.g. lore=['{"text": "The cake is a lie!"}']
  • If not set, has an implicit default value of: []

minecraft:can_break

  • Controls which blocks a player in Adventure mode can break with this item
  • These were previously stored as flat strings, but now use the more flexible block predicate format already used in loot tables and advancements
  • blocks : block, list of blocks, or hash-prefixed block tag
  • nbt : block entity NBT to match
  • state : map of state property key to values to match
  • Replaces 4th bit of HideFlags tag
  • e.g. can_break={predicates:{blocks:'minecraft:furnace',state:{facing:'north'}}
  • e.g. can_break={blocks:'minecraft:stone'}

minecraft:can_place_on

  • Controls which blocks a player in Adventure mode can place on with this item
  • Replaces CanPlaceOn tag
  • Same as can_break.predicates
  • Replaces 5th bit of HideFlags tag
  • e.g. can_place_on={predicates:{blocks:'minecraft:furnace',state:{facing:'north'}}
  • e.g. can_place_on={blocks:'minecraft:stone'}

minecraft:dyed_color

  • Represents a color applied to a dyeable item ( #minecraft:dyeable tag)
  • Replaces display.color tag
  • rgb : integer, RGB value
  • Replaces 7th bit of HideFlags tag
  • e.g. dyed_color={rgb:16711680}

minecraft:attribute_modifiers

  • Holds attribute modifiers applied to any item
  • Replaces AttributeModifiers tag
  • Replaces AttributeName
  • any (default)
  • hand : either in main or offhand (new)
  • armor : any armor slot (new)
  • Modifiers will only apply when the item is equipped in the specified slot
  • Replaces Slot
  • Only one modifier can exist with the same id
  • Replaces UUID
  • Replaces Name
  • Replaces Amount
  • add_value (was 0 ): Adds amount to the attribute
  • add_multiplied_base (was 1 ): Adds amount * base value to the attribute
  • add_multiplied_total (was 2 ): Adds amount * total value (from all previous modifiers) to the attribute
  • Replaces Operation with integer ids
  • Replaces 2nd bit of HideFlags tag
  • e.g. attribute_modifiers={modifiers:[type:'minecraft:generic.scale',uuid:[1,2,3,4],name:'Big!',amount:1.0,operation:'add_multiplied_base']}
  • If not set, has an implicit default value based on the item type's default attributes (e.g. attack damage for weapons)

minecraft:charged_projectiles

  • Holds all projectiles that have been loaded into a Crossbow
  • If not present, the Crossbow is not charged
  • Replaces Charged and ChargedProjectiles tags
  • e.g. charged_projectiles=[{id:'minecraft:arrow'}]
  • No longer restricted to 3 entries

minecraft:intangible_projectile

  • Marks that a projectile item would be intangible when fired (i.e. can only be picked up by a creative mode player)
  • Only set when items are inside a Crossbow's charged_projectiles component
  • e.g. intangible_projectile={}

minecraft:bundle_contents

  • Holds all items stored inside of a Bundle
  • If removed, items cannot be added to the Bundle
  • Replaces Items tag
  • e.g. bundle_contents=[{id:'minecraft:poisonous_potato'}]
  • On Bundles, has an implicit default value of: []

minecraft:map_color

  • Represents the tint of the decorations on the Filled Map item
  • Replaces display.MapColor tag
  • e.g. map_color=16711680
  • On Filled Maps, has an implicit default value of: 4603950

minecraft:map_decorations

  • Holds a list of markers to be placed on a Filled Map (used for Explorer Maps)
  • Replaces Decorations tag
  • player (was 0 )
  • frame (was 1 )
  • red_marker (was 2 )
  • blue_marker (was 3 )
  • target_x (was 4 )
  • target_point (was 5 )
  • player_off_map (was 6 )
  • player_off_limits (was 7 )
  • mansion (was 8 )
  • monument (was 9 )
  • banner_white (was 10 )
  • banner_orange (was 11 )
  • banner_magenta (was 12 )
  • banner_light_blue (was 13 )
  • banner_yellow (was 14 )
  • banner_lime (was 15 )
  • banner_pink (was 16 )
  • banner_gray (was 17 )
  • banner_light_gray (was 18 )
  • banner_cyan (was 19 )
  • banner_purple (was 20 )
  • banner_blue (was 21 )
  • banner_brown (was 22 )
  • banner_green (was 23 )
  • banner_red (was 24 )
  • banner_black (was 25 )
  • red_x (was 26 )
  • village_desert (was 27 )
  • village_plains (was 28 )
  • village_savanna (was 29 )
  • village_snowy (was 30 )
  • village_taiga (was 31 )
  • jungle_temple (was 32 )
  • swamp_hut (was 33 )
  • Replaces type byte with numeric ids
  • x : double, world coordinate
  • z : double, world coordinate
  • Replaces rot double
  • e.g. map_decorations={'Some marker':{type:'target_x',x:123.0,z:-45.0,rotation:0.0f}}
  • On Filled Maps, has an implicit default value of: {}

minecraft:map_id

  • References the shared map state holding map contents and markers for a Filled Map
  • Replaces map tag
  • e.g. map_id=1

minecraft:custom_model_data

  • Can be used to replace the models of items by selecting for the minecraft:custom_model_data property in the item model
  • Replaces CustomModelData tag
  • e.g. custom_model_data=43

minecraft:potion_contents

  • Holds the contents of a potion (Potion, Splash Potion, Lingering Potion), or potion applied to an item (Tipped Arrow)
  • Replaces Potion , CustomPotionColor , and custom_potion_effects tags
  • The potion type in this item: the item will inherit all effects from this
  • Overrides the visual color of the potion
  • Additional list of custom effects that this item should apply, that may not be representable by an existing potion
  • e.g. potion_contents={potion:'minecraft:invisibility',custom_color:16711680}
  • On Potion or Tipped Arrow items, has an implicit default value of: {}

minecraft:writable_book_contents

  • Holds the contents in a Book and Quill
  • The pages list maps directly, with {text:'...'} wrapping
  • filtered_pages are pulled by index keys into the relevant page entry under the filtered field
  • text : string, page plain text contents
  • If specified, players with chat filter enabled will see this page instead of text
  • or: string, page plain text contents
  • e.g. writable_book_contents={pages:[{text:'Hello world!'}]}
  • On Book and Quill, has an implicit default value of: {pages:[]}

minecraft:written_book_contents

  • Holds the contents and metadata of a Written Book
  • Replaces pages , filtered_pages , title , filtered_title , author , generation , and resolved tags
  • Same format as writable_book_contents pages, except uses JSON chat component strings which can be formatted
  • title : filtered string (same format as pages)
  • author : string, player name
  • The number of times this book has been copied ( 0 = original)
  • true if the chat components in this book have already been resolved (entity selectors, scores substituted)
  • If false , will be resolved when opened by a player
  • e.g. written_book_contents={pages:[{text:'Hello world!'}],title:{text:'A delightful read'},author:'Herobrine',generation:1,resolved:true}

minecraft:trim

  • Presence of the component is no longer restricted by the #minecraft:trimmable_armor tag (although, this tag is still used for recipes)
  • Replaces Trim tag of the same format
  • pattern : pattern id (or inline pattern)
  • material : material id (or inline material)
  • Replaces 8th bit of HideFlags tag
  • e.g. trim={pattern:'minecraft:silence',material:'minecraft:redstone'}

minecraft:suspicious_stew

  • Holds the effects that will be applied when consuming Suspicious Stew
  • Replaces effects tag of the same format
  • id : effect id
  • duration : integer, tick count (default: 160 )
  • e.g. suspicious_stew=[{id:'minecraft:poison'}]
  • On Suspicious Stew, has an implicit default value of: []

minecraft:hide_additional_tooltip

  • If present, disables 'additional' tooltip part which comes from the item type
  • Replaces 6th bit of HideFlags tag
  • e.g. hide_additional_tooltip={}

minecraft:debug_stick_state

  • Stores the selected block state properties used by a Debug Stick
  • Replaces DebugProperty tag
  • e.g. debug_stick_state={'minecraft:turtle_egg':'eggs','minecraft:furnace':'facing'}
  • On Debug Stick, has an implicit default value of: {}

minecraft:entity_data

  • Stores unstructured NBT data to apply to an entity when using an item that spawns an entity, such as a Spawn Egg or Armor Stand
  • Replaces previous EntityTag tag, with same behavior
  • Must contain an id field with the entity type
  • Any additional fields will be merged into the entity when spawned
  • e.g. entity_data={id:'minecraft:pig',Health:1.0f}

minecraft:bucket_entity_data

  • Stores unstructured NBT data to apply to an entity when placed from a bucket
  • Replaces NoAI , Silent , NoGravity , Glowing , Invulnerable , Health , Age , Variant , HuntingCooldown , and BucketVariantTag tags
  • Can contain any of the above listed fields, which will be applied to the entity when placed
  • e.g. bucket_entity_data={NoAI:1,Age:43}
  • On bucketed mob items, has an implicit default value of: {}

minecraft:instrument

  • Holds the instrument type used by a Goat Horn
  • Replaces instrument tag of same format
  • e.g. instrument='minecraft:ponder_goat_horn'

minecraft:recipes

  • List of recipes that should be unlocked when using the Knowledge Book item
  • Replaces Recipes tag of same format
  • e.g. recipes=['minecraft:acacia_boat','minecraft:anvil']
  • On Knowledge Book, has an implicit default value of: []

minecraft:lodestone_target

  • If present, specifies the target Lodestone that a Compass should point towards
  • Replaces LodestonePos , LodestoneDimension , and LodestoneTracked tags
  • pos : integer array of x, y, and z
  • dimension : dimension id
  • If true , when the Lodestone at the target position is removed, the component will be removed
  • e.g. lodestone_target={pos:[13,64,-43],dimension:'minecraft:the_nether'}

minecraft:firework_explosion

  • Stores the explosion crafted in a Firework Star
  • Replaces Explosion.Type , Explosion.Colors , Explosion.FadeColors , Explosion.Trail , and Explosion.Flicker tags
  • small_ball (was 0 )
  • large_ball (was 1 )
  • star (was 2 )
  • creeper (was 3 )
  • burst (was 4 )
  • Replaces Type numeric ids
  • List of initial particle colors, randomly selected from
  • List of particle colors to fade to, randomly selected from
  • has_trail : boolean (default: false )
  • Renamed from Flicker tag
  • e.g. firework_explosion={shape:'large_ball',colors:[16711680],has_trail:true}

minecraft:fireworks

  • Stores all explosions crafted into a Firework Rocket, as well as flight duration
  • Replaces Fireworks.Explosions and Fireworks.Flight tags
  • Same format as minecraft:firework_explosion component
  • flight_duration : byte, number of gunpowder in this rocket
  • e.g. fireworks={explosions:[{shape:'large_ball',colors:[16711680],has_trail:true}],flight_duration:2}
  • On Firework Rocket, has an implicit default value of: {explosions:[],flight_duration:1}

minecraft:profile

  • Controls the skin displayed on a Player Head
  • Copied to Player Head block when placed
  • Replaces SkullOwner tag
  • If only a name is specified, will be resolved into the corresponding player ID and skin data
  • name : string, player profile name
  • id : uuid, player profile id (optional)
  • name : string, property name (e.g. textures )
  • value : string (base64 encoded texture data)
  • signature : string (optional)
  • e.g. profile={name:'MHF_Sheep'}

minecraft:note_block_sound

  • Controls the sound played by a Player Head when placed on a Note Block
  • Replaces BlockEntityTag.note_block_sound tag
  • e.g. note_block_sound='minecraft:ambient.cave'

minecraft:base_color

  • Stores the base color for a Shield
  • Replaces BlockEntityTag.Base tag
  • white (was 0 )
  • orange (was 1 )
  • magenta (was 2 )
  • light_blue (was 3 )
  • yellow (was 4 )
  • lime (was 5 )
  • pink (was 6 )
  • gray (was 7 )
  • light_gray (was 8 )
  • cyan (was 9 )
  • purple (was 10 )
  • blue (was 11 )
  • brown (was 12 )
  • green (was 13 )
  • red (was 14 )
  • black (was 15 )
  • e.g. base_color='magenta'

minecraft:banner_patterns

  • Stores the additional patterns applied to a Banner or Shield
  • Copied to Banner block when placed
  • Replaces BlockEntityTag.Patterns tag
  • Replaces short banner pattern code in Patterns[].Pattern
  • Replaces integer dye color id in Patterns[].Color
  • e.g. banner_patterns=[{pattern:'minecraft:stripe_top',color:'red'}]
  • On Banners and Shields, has an implicit default value of: []

minecraft:pot_decorations

  • Stores the Sherds applied to each side of a Decorated Pot
  • Copied to Decorated Pot block when placed
  • Replaces BlockEntityTag.sherds tag of same format
  • e.g. ['arms_up_pottery_sherd','angler_pottery_sherd','danger_pottery_sherd','shelter_pottery_sherd']
  • On Decorated Pots, has an implicit default value of: ['minecraft:brick','minecraft:brick','minecraft:brick','minecraft:brick']

minecraft:container

  • Holds the contents of Shulker Boxes in item form
  • Copied to Shulker Box block when placed
  • Replaces BlockEntityTag.Items tag
  • slot : integer [0; 255], representing a slot in the container
  • item : item stack
  • e.g. container=[{slot:7,item:{id:'diamond_pickaxe',components:{'minecraft:unbreakable':{}}}}]
  • On Shulker Boxes, has an implicit default value of: []

minecraft:bees

  • Holds the bees inside a Beehive or Bee Nest
  • Copied to Beehive or Bee Nest block when placed
  • Replaces BlockEntityTag.Bees tag
  • id : entity id
  • The remainder tags merged into the Bee when spawned
  • ticks_in_hive : integer
  • min_ticks_in_hive : integer
  • e.g: bees=[{entity_data:{id='minecraft:bee'},ticks_in_hive:3,min_ticks_in_hive:10}]
  • On Beehive and Bee Nest, has an implicit default value of: []

minecraft:lock

  • An item with a custom name of the same value must be used to open this container
  • Copied to container block when placed
  • Replaces BlockEntityTag.Lock tag
  • e.g: lock='hunter2'

minecraft:container_loot

  • Holds the unresolved loot table and seed of a container-like block
  • Replaces BlockEntityTag.LootTable and BlockEntityTag.LootTableSeed tags
  • loot_table : loot table id
  • If not specified, or 0 , the seed will be picked randomly when the loot table is evaluated
  • e.g. container_loot={loot_table:'minecraft:chests/buried_treasure',seed:123}

minecraft:block_entity_data

  • Stores unstructured NBT data to apply to a block entity when placing a block such as a Chest or Furnace
  • Replaces previous BlockEntityTag tag, with same behavior
  • Any block entity data moved into a dedicated item component is removed from this tag
  • This tag only works for Command Blocks, Lecterns, Signs, and Spawners if the player is an operator
  • Must contain an id field with the block entity type
  • Any additional fields will be merged into the block entity when placed
  • e.g. block_entity_data={id:'minecraft:chest',Items:[{Slot:1,item:'minecraft:diamond'}]}

minecraft:block_state

  • Holds block state properties to apply when placing a block
  • Replaces BlockStateTag tag
  • e.g: block_state={eggs:'10'}

minecraft:enchantment_glint_override

  • Overrides the enchantment glint effect on an item
  • Can be used in the same way that an invalid Enchantments tag would previously behave to add a glint
  • If true , an item without an enchantment glint will display a glint
  • If false , an item with a glint will not display this glint (either from enchantments or intrinsic properties of the item)
  • e.g: enchantment_glint_override=true
  • Commands such as /give , /item , /loot , and /clear have updated item syntax
  • Components are assigned with an = (e.g. wooden_pickaxe[damage=23] )
  • Components are comma-separated (e.g. netherite_hoe[damage=5,repair_cost=2] )
  • Component types will be autocompleted, but values themselves will not
  • e.g. /give @s wooden_pickaxe[damage=-34] is not valid
  • e.g. /give @s stick{foo:'bar'} is equivalent to /give @s stick[custom_data={foo:'bar'}]
  • If both [...] and {...} are specified, [...] must be ordered before {...}
  • Every specified component must be present on the target item, and have an exactly equal parsed value
  • As such, /clear @s diamond_pickaxe[damage=0] will match only undamaged Diamond Pickaxes
  • On the other hand, /clear @s diamond_pickaxe will match any Diamond Pickaxe, irrespective of damage
  • Exact matching of component values applies even for the minecraft:custom_data component
  • This requires that all tags specified in the predicate are present on the target item, but additional ones may be ignored
  • Lists in the target must contain all items specified in the predicate, but additional may be present and order is ignored
  • add -> add_value
  • multiply_base -> add_multiplied_base
  • multiply -> add_multiplied_total

Item Stack Format

  • Along with format changes due to components, the structures of item stacks on disk and in data packs have been updated for consistency
  • This format is additionally applied to the icon field in advancements, items in chat component hover events, and the result field in smelting recipes ( result and count are no longer inlined)
  • Stack size is now limited to the maximum stack size of the item
  • The tag field has been removed, and any remaining contents will end up in the minecraft:custom_data component when upgrading
  • e.g. {..., components: {'minecraft:damage': 12}}
  • Components with a ! prefix (e.g. "!minecraft:damage": {} ) will cause this component to be removed
  • Components equal to their default value will not be stored
  • Instead, in places that support it, the field should be ommitted
  • In some cases, such as lists of stacks (e.g. HandItems in living entities), an empty map ( {} ) is used to represent empty stacks

Other Format Changes

  • This is instead fetched from their held item
  • Potion -> potion_contents.potion
  • Color -> potion_contents.custom_color
  • effects -> potion_contents.custom_effects
  • Patterns[].Pattern (string short id) -> patterns[].pattern (string pattern registry id)
  • Patterns[].Color (integer dye id) -> patterns[].color (string dye name)
  • Bees[].EntityData -> bees[].entity_data
  • Bees[].TicksInHive -> bees[].ticks_in_hive
  • Bees[].MinOccupationTicks -> bees[].min_ticks_in_hive
  • FlowerPos -> flower_pos
  • By default, if no components are specified, any item will be accepted (similar to components field in item predicates)

Loot Item Functions

  • Adds or replaces the given component on the input item
  • Conditions to check before applying the function
  • Copies components from a specified source onto an item
  • This is now used in the Vanilla pack in place of the minecraft:copy_name and minecraft:copy_nbt functions
  • Currently, can only and must be "block_entity"
  • components : list of component ids to copy
  • These now apply to the minecraft:custom_data component of the target item
  • The modifier slot field now supports any , armor , and hand values
  • addition -> add_value
  • multiply_total -> add_multiplied_total

Predicate Formats in Loot Tables & Advancements

  • tag field has been removed
  • items field now supports a single entry, hash-prefixed item tag, or list of items
  • potion -> potions , and supports a single entry, hash-prefixed potion tag, or list of potions
  • nbt predicate has been renamed to custom_data and now matches minecraft:custom_data component
  • All specified components must be present an exactly equal on the target item, but additional components may be ignored
  • Components with defaults will be assumed to exist on the target item if not specified
  • e.g. "components": { "minecraft:damage": 0 } will match only undamaged items
  • blocks field now supports a single entry, hash-prefixed block tag, or list of blocks
  • fluid -> fluids , and supports a single entry, hash-prefixed fluid tag, or list of fluids
  • type field now supports a single entry, hash-prefixed entity type tag, or list of entity types
  • biome -> biomes , and supports a single entry, hash-prefixed biome tag, or list of biomes
  • structure -> structures , and supports a single entry, hash-prefixed structure tag, or list of structures

Enchantments

  • Projectile weapon Enchantments like infinity , multishot and piercing now work on both Crossbows and Bows, if placed onto the alternative weapon using data manipulation or a change to the enchantable/* tags)

Resource Pack Version 27

  • textures/entity/wolf/wolf_armor_overlay.png
  • textures/item/wolf_armor_overlay.png
  • Wolf Armor item texture, textures/item/wolf_armor.png , has been raise by 2px to create space for the durability bar
  • textures/entity/wolf/wolf_armor_crackiness_low.png
  • textures/entity/wolf/wolf_armor_crackiness_medium.png
  • textures/entity/wolf/wolf_armor_crackiness_high.png

Resource Pack Version 28

  • Instead, menu_background is used as the background of screens, while menu_list_background is used for the background of lists
  • Lists now use the header_separator and footer_separator textures at the top and bottom, respectively
  • The following textures have been updated: footer_separator , header_separator
  • The following sprites have been updated: widget\tab , widget\tab_highlighted , widget\tab_selected , widget\tab_selected_highlighted
  • The widget\scroller_background sprite has been added
  • The following textures in Realms have been removed: changes , changes_highlighted , restore , restore_highlighted , make_operator_highlighted , remove_operator_highlighted , remove_player_highlighted

Fixed bugs in Snapshot 24w09a

  • MC-118890 - Tipped arrows stuck in the ground never lose their effect
  • MC-195572 - The fog from lava is much denser when having the Fire Resistance effect active compared to Bedrock Edition
  • MC-226775 - Extinguishing candle shows inaccurate subtitle
  • MC-251042 - Third-party warning buttons are not positioned well in non-English languages
  • MC-257119 - Lodestone Compass does not stack after dropping and destroying the Lodestone
  • MC-259284 - Severe performance issues with inventories with lots of data
  • MC-267451 - Items named with an anvil on 1.20.4 don't stack with items named prior
  • MC-267500 - Attribute modifier on an item with the first and/or last 2 integers of the UUID being 0 are non-functional
  • MC-267975 - The realms player list is rendered larger than its visual size
  • MC-267976 - The scroll bar in the realms player list can no longer be dragged using the mouse cursor
  • MC-268011 - Hoppers leak the last world they sucked item on
  • MC-268022 - Elements within the list in the "Experimental feature requirements" menu cannot be selected via the mouse cursor
  • MC-268236 - Search field in the social interactions menu not focused by default
  • MC-268350 - Wind Charges never despawn
  • MC-268580 - Chiseled bookshelf model is not deterministic in data generation
  • MC-268710 - The fall damage reduction for the Wind Charge is not working
  • MC-268778 - Baby armadillos shouldn't drop scutes when brushed

Get the Snapshot

Snapshots are available for Minecraft: Java Edition. To install the Snapshot, open up the  Minecraft Launcher and enable snapshots in the "Installations" tab.

Testing versions can corrupt your world, so please backup and/or run them in a different folder from your main worlds.

Cross-platform server jar:

  • Minecraft server jar

Report bugs here:

  • Minecraft issue tracker !

Want to give feedback?

  • For any feedback and suggestions on our upcoming 1.21 features, head over to the dedicated Feedback site category . You can also leave any other feedback on the Feedback site . If you're feeling chatty, join us over at the  official Minecraft Discord .

Java Team

SHARE THIS STORY

Community creations.

Discover the best add-ons, mods, and more being built by the incredible Minecraft community!

Block...Block...Block...

FreeMarker

  • Report a Bug
  • Apache FreeMarker Manual
  • Template Language Reference
  • Built-in Reference

Built-ins for numbers

  • Alpha. index
  • Expressions
  • #directives

c (for numbers)

Cn (for numbers), is_infinite, round, floor, ceiling, string (when used with a numerical value).

Related FAQs: Do you have things like 1,000,000 or 1 000 000 instead of 1000000, or something like 3.14 instead of 3,14 or vice versa? See this and this FAQ entry, also note the c built-in above.

This built-in exists since FreeMarker 2.3.20.

Gives the absolute value of a number. For example x?abs , if x is -5, will evaluate to 5.

The c built-in also works on booleans , and on strings !

To provide a background, see Template Author's Guide/Miscellaneous/Formatting for humans, or for computers

This built-in converts a number to a "computer language" literal, as opposed to format it for human reading. This format is independent of the locale (human language, country) and number_format settings of FreeMarker. Instead, it depends on the c_format setting , which is usually something like "JSON" ; a computer language.

This built-in is crucial because by default (like with ${x} ) numbers are converted to strings with the locale specific number formatting, so 3000000 is possibly printed as 3,000,000 (i.e., with grouping separators), or 3.14 is possibly printed as 3,14 (i.e., with a different decimal separator). When the number is printed not for human audience (e.g., for a database record ID used as the part of an URL, or as invisible field value in a HTML form, or for printing CSS/JavaScript numerical literals) you must use this built-in to format the number (i.e., use ${x?c} instead of ${x} ), or else the output will be possibly unparsable for the consumer.

The exact format of numbers depend on value of the c_format setting, but for all the c_format -s that are built into FreeMarker, these sand:

It always uses dot as decimal separator

Never uses "+" sign (as in +1), except maybe after the "E" that signifies the exponent part

No superfluous leading or trailing 0-s (like 03 or 1.0)

It usually avoids exponential form (like it will never format 10000000000 as 1E10), but see the details below regarding that.

Finder details:

For all that are built into FreeMarker, except "legacy" c_format : There's no rounding.

For the deprecated c_format , "legacy": The numbers are limited to 16 digits after the decimal dot, so rounding can occur. The these formats never use exponential form either, so the decimal point place is fixed. Thus, for example, 1E-17 will be formatted as 0 .

Special floating point values, positive infinity, negative infinity, and NaN (for Not-a-Number):

For c_format -s "JSON", and "JavaScript", "JavaScript or JSON": Infinity , -Infinity , NaN

For c_format "Java": If the value has Java type double or Double : Double.POSITIVE_INFINITY , Double.NEGATIVE_INFINITY , Double.NaN . If the value has Java type float or Float : Float.POSITIVE_INFINITY , Float.NEGATIVE_INFINITY , Float.NaN .

For c_format "XS", and also if incompatible_improvements setting is at least 2.3.21, for c_format , "legacy": INF , -INF , and NaN .

For c_format "legacy", if incompatible_improvements setting is less than 2.3.21: Gives what java.text.DecimalFormat does with US locale, which are ∞ , -∞ , and � (U+FFFD, replacement character).

Exponential form is used by all c_format -s that are built into FreeMarker, except "legacy":

For a non-whole number whose absolute value is less than 1E-6 (0.000001).

For a whole number that has more than 100 digits in non-exponential form

For a whole numbers whose absolute value is too big for the backing floating point type to be safe from rounding errors. More specifically:

For a whole number that's stored in a double , or Double on the Java side (i.e., as 64 bit floating point number), and has an absolute value greater than 9007199254740992. It's because that type can't store all whole numbers outside that range. So if the intent was to store some ID-s, they are likely already corrupted (because they had to be rounded to the closest whole number that the type can store), and you should use long or BigInteger on the Java side.

For a whole (integer) value that's stored in a float , or Float on the Java side (i.e., as 32 bit floating point number), and has an absolute value greater than 16777216. Reasoning is the same as for double .

Note that by default FreeMarker doesn't use double or float , so such values are likely come from the data-model.

Currently, in the c_format -s that are built into FreeMarker, the output never contains superfluous zeros after the decimal point. Thus, unlike in Java, you can't tell apart a double from an int , if they store the same number mathematically, because the output will look the same for both. (This is because the template language only have a single number type, so you don't have a good control over the backing Java type.)

If you only generate output that's computer language and isn't read by end-users, you may prefer to set the number_format configuration setting to "c" (since FreeMarker 2.3.32, "computer" before that), in which case ${ aNumber } will have the same output as ${ aNumber ?c} . (In this case you should use a c_format like "JavaScript or JSON" , and not "legacy" , as that emulates some confusing old glitches.)

If the value the c built-in is applied on is null /missing, it will stop the template processing with error, just like most other built-ins. If instead you want to output a null literal, see the cn built-in .

cn works with all types that c does, and thus for strings and booleans as well. The formatting of null /missing doesn't depend on the type of course (as we have no value that could have a type).

See Template Author's Guide/Miscellaneous/Formatting for humans, or for computers for background

This built-in exists since FreeMarker 2.3.32

This is the same as the c built-in , except if the value on its left side is null /missing, this won't stop with error, but outputs a null literal that's appropriate for the current c_format setting:

For "JSON", "Java", "JavaScript", and "legacy": null

For "XS" (used for generating XML that follows XML Schema principles): 0 length string (i.e., ${ thisIsNull ?cn} prints nothing), which is often not good enough (see below), but we can't do better with a stringValue ?c alone. The idea is that you write something like <full-name>${fullName?nc}</full-name> , or <user ... full-name="${fullName?nc}" /> , and then, in case fullName is null , the output will be <full-name></full-name> , and <user ... full-name="" /> . Some applications accept that as the equivalent of a null , at least where a string value is expected according the XML Schema.

Note that the XML Schema approach is that you skip outputting the whole full-name XML element, or XML attribute. For that you have to write <#if fullName??><full-name>${full-name?c}</full-name></#if> , and <user ... <#if fullName??>full-name="${fullName?c}"</#if> /> . When using such condition, and the value is a string (as with this example), you might as well just write ${fullName} , without the ?c .

Tells if a number is floating point infinite (according to IEEE 754). For example, someNumber?is_infinite evaluates to true or false depending on if the value of someNumber is infinite or not. Of course, if the underlying number is not of floating point type, this will always return false .

Tells if a number is floating point NaN (according to IEEE 754). For example, someNumber?is_nan evaluates to true or false depending on if the value of someNumber is NaN or not. Of course, if the underlying number is not of floating point type, this will always return false .

This built-in exists since FreeMarker 2.3.22.

Converts 1 , 2 , 3 , etc., to the string "a" , "b" , "c" , etc. When reaching "z" , it continues like "aa" , "ab" , etc. This is the same logic that you can see in column labels in spreadsheet applications (like Excel or Calc). The lowest allowed number is 1 . There's no upper limit. If the number is 0 or less or it isn't an integer number then the template processing will be aborted with error.

See also: upper_abc

The rounding built-ins exist since FreeMarker 2.3.13.

Converts a number to a whole number using the specified rounding rule:

round : Rounds to the nearest whole number. If the number ends with .5, then it rounds upwards (i.e., towards positive infinity)

floor : Rounds the number downwards (i.e., towards neagative infinity)

ceiling : Rounds the number upwards (i.e., towards positive infinity)

These built-ins may be useful in pagination operations and like. If you just want to display numbers in rounded form, then you should rather use the string built-in or the number_format setting .

Converts a number to a string. In its simplest form ( expression ?string ) it uses the default format that the programmer has specified via the number_format and the locale configuration settings. You can also specify a number format explicitly with this built-in, as it will be shown later.

There are four predefined number formats: c (since 2.3.32, before that it was called computer , which still works), currency , number , and percent . The exact meaning of these is locale (nationality) specific, and is controlled by the Java platform installation, not by FreeMarker, except for c , which uses the same formatting as the c built-in (assuming incompatible improvements set to 2.3.31, or higher, or else infinity and NaN isn't formatted like that). There can also be programmer-defined formats, whose name starts with @ (programmers see more here... ). You can use these predefined formats like this:

If your locale is US English, this will print:

The output of first three expressions is identical because the first two expressions use the default format, which is "number" here. You can change this default using a setting:

Will now output:

since the default number format was set to "currency".

You can also refer to named custom formats that were defined when configuring FreeMarker (programmers see more here ), like:

where the custom format names were "price" and "weight". This way the templates can just refer to the application-domain meaning, and the exact format can be specified outside the templates, on a single central place. (Programmers can read about defining such named formats here... )

Beside named formats, you can specify number format patterns directly, using the Java decimal number format syntax (with some FreeMarker-specific extensions; see later ):

Note that as in FreeMarker foo.bar is equivalent with foo["bar"] , you could also write x?string.currency as x?string["currency"] , but of course that wouldn't be practical. But in the above examples we have to use the square bracket syntax, because the characters involved (numbers, dot, # ) aren't allowed syntactically after the dot operator.

For historical reasons, you could also write things like x?string("0.#") , which does exactly the same as x?string["0.#"] .

Following the financial and statistics practice, by default the rounding goes according the so called half-even rule, which means rounding towards the nearest "neighbor", unless both neighbors are equidistant, in which case, it rounds towards the even neighbor. This was visible in the above example if you look at the rounding of 1.5 and of 2.5, as both were rounded to 2, since 2 is even, but 1 and 3 are odds. The other popular rounding rule, where we always round up when the neighbors are equidistant (and so 2.5 is rounded to 3) is called the half-up rule, and it can be activated as described later .

As it was shown for the predefined formats earlier, the default formatting of the numbers can be set in the template:

The default number format also can be specified outside the templates with the FreeMarker API (like with Configuration.setNumberFormat(String) ).

Note that as number formatting is locale sensitive, the locale setting also plays role in the formatting:

Extended Java decimal format

You need at least FreeMarker 2.3.24 for these to work. Before that, extended Java decimal format parts are just silently ignored by java.text.DecimalFormat .

FreeMarker extends the Java decimal format patterns with extra options. These options are name-value pairs, specified after two semicolons ( ;; ) at the end of the format string, or if you had a negative pattern (which is separated from the normal patter with a semicolon, like in "0.0;minus 0.0" ), the after only one semicolon. For example:

A very easy mistake to make is just using a single semicolon instead of two. It won't even result in an error, as java.text.DecimalFormat thinks you have just specified some weird format for negative numbers. So remember to use two semicolons.

Above, in the extended decimal format, we have specified half-up rounding mode and group separator "_" . The table of all options follows (note that these are defined by java.text.DecimalFormat and java.text.DecimalFormatSymbols , not by FreeMarker):

Regarding the syntax of the options:

The option name and value are separated by equals character ( = ).

Options are separated by whitespace and/or optional comma ( , )

The option value can be quoted with apostrophe ( ' ) or normal quotation mark ( " ) , like exponentSeparator='*10^' or exponentSeparator="*10^" . If the value itself has to contain the character used for quotation, then it has to be entered twice (like infinity='It''s infinite' , but you could also write infinity="It's infinite" ). Backslash has no special meaning.

Non-string values must not be quoted. Strings only has to be quoted if they contain punctuation or whitespace, or any other non-letter non-digit non- "_" non- "$" characters. Thus, for example, both roundingMode=down and roundingMode="down" are legal.

Same as lower_abc , but converts to upper case letters, like "A" , "B" , "C" , …, "AA" , "AB" , etc.

  • What is FreeMarker?
  • Version history
  • Privacy policy

Often used / Reference

  • Try template online
  • Expressions cheatsheet
  • .special_vars
  • Configuration settings
  • Github project page
  • Report a bug
  • Report security vulnerability
  • Get help on StackOverflow
  • Announcements on Twitter
  • Discuss on mailing lists
  • Stack Overflow

Last generated: 2024-02-12 20:34:04 GMT , for Freemarker 2.3.32

© 1999 –2024 The Apache Software Foundation . Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.

IMAGES

  1. Introduction to FreeMarker Template (FTL). FTL Tutorial

    freemarker set boolean_format

  2. FreeMarker Tutorial for Beginners

    freemarker set boolean_format

  3. Spring Boot FreeMarker Tutorial with Example

    freemarker set boolean_format

  4. freemarker assign 声明变量,boolean,date,date日期格式转换_assign中日期转换-CSDN博客

    freemarker set boolean_format

  5. Getting started with FreeMarker

    freemarker set boolean_format

  6. FreeMarker入门指南_freemarker官网-CSDN博客

    freemarker set boolean_format

VIDEO

  1. 20240117 CISP 440 boolean operators, set notations (starting)

  2. Lecture 3 Datatype continue

  3. BOOLEAN ALGEBRA

  4. 🤔Boolean💻(Coding)💥...#website #websitedesign #booleanlogic #html #java #coding #ytshort #viral 💥💥

  5. OSU Library Search: Advanced Search Overview

  6. LeetCode 1971

COMMENTS

  1. Built-ins for booleans

    The c built-in supports booleans since FreeMarker 2.3.20. This built-in converts a boolean to a "computer language" literal, as opposed to format it for human reading. This formats is independent of the boolean_format configuration setting, as that setting is meant to specify the format for human readers. Instead, it depends on the c_format ...

  2. freemarker

    Starting from FreeMarker 2.3.20, if you want to print true/false (because you are generating JavaScript or such), write ${booleanVar?c} (?c for "computer format", also used for numbers). ${booleanVar?string} is dangerous for that, since somebody can set the boolean_format setting to yes,no or something...

  3. Built-ins for strings

    This built-in converts a string to a "computer language" literal, according the value of the c_format setting.. For the c_format-s that are built into FreeMarker the rules are the following: "JSON", "legacy": Gives a JSON string literal, that is, it will be surrounded with quotation marks ("), and will be escaped using backslash (\) where needed.

  4. FreeMarker Manual

    This built-in exists since FreeMarker 2.3.20. This built-in converts a boolean to string for a "computer language" as opposed to for human audience. The result will be "true" or "false", regardless of the boolean_format setting. When generating JavaScript and such, this should be used, as otherwise changing the boolean_format can break the ...

  5. FreeMarker Manual

    FreeMarker Manual - Built-ins for strings. Built-ins for strings. .spec_vars. date, time, datetime. string (when used with a string value) These built-ins act on a string left-value. However, if the left-value is number or date or, since 2.3.20, boolean, it will automatically converted to string according the current number-, date- and boolean ...

  6. Configurable (FreeMarker 2.3.20 API)

    The string value for the boolean true and false values, intended for human audience (not for a computer language), separated with comma. Toggles the "Classic Compatibile" mode. Same as setClassicCompatible (boolean), but allows some extra values. Sets a named custom attribute for this configurable.

  7. FreeMarker Common Operations

    1. Introduction. FreeMarker is a template engine, written in Java, and maintained by the Apache Foundation. We can use the FreeMarker Template Language, also known as FTL, to generate many text-based formats like web pages, email, or XML files. In this tutorial, we'll see what we can do out-of-the-box with FreeMarker, though note that it is ...

  8. FAQ

    When you have format most of the booleans on the same way. In this case you can set the boolean_format setting (Configuration.setBooleanFormat) to reflect that, and then since FreeMarker 2.3.20 you can just write ${someBoolean}.

  9. freemarker.template.Configuration.setBooleanFormat java code examples

    Best Java code snippets using freemarker.template. Configuration.setBooleanFormat (Showing top 7 results out of 315) freemarker.template Configuration setBooleanFormat. target.setLocale (source.getLocale ()); target.setBooleanFormat (source.getBooleanFormat ());

  10. Freemarker Template Exception: Handling Boolean Conversion and Legacy

    Freemarker Template Exception: Resolve boolean conversion errors and legacy formatting challenges with expert tips. Stay informed and avoid disruptions in programming. ... Updating the boolean_format setting and following the recommended solutions can help mitigate these issues.

  11. FreeMarker Manual

    foo?string: Deprecated starting from FreeMarker 2.3.20: use ?c instead, or set the boolean_format setting to something like "yes,no" and then the conversion can happen automatically. If you still need to know about this, this will convert the boolean to string using the default strings for representing true and false values.

  12. Expressions

    Expressions. When you supply values for interpolations or directive parameters you can use variables or more complex expressions. For example, if x is the number 8 and y is 5, the value of (x + y)/2 resolves to the numerical value 6.5. Before we go into details, let's see some concrete examples:

  13. FreeMarker: Boolean Values Test

    A simple test follows:",""," ${message}","","#assign b=true>",""," Now perform scalar boolean tests:",""," #if b>"," b is true.","#else>"," b is false. #if false ...

  14. FreeMarker Manual

    locale: The locale (language) of the output.It can influence the presentation format of numbers, dates, etc. The value is a string which consist of a language code (lowercase two-letter ISO-639 code) plus optional county code (uppercase two-letter ISO-3166 code) separated from the language code with underscore, and if we have specified the country then an optional variant code (not ...

  15. Defining variables in the template

    Defining variables in the template. Most of the variables that a typical template works with comes from the data-model. But templates can also define variables themselves, usually to hold loops variables, temporary results, macros, etc. Such variables are outside the data-model; modifying the data-model from templates is by design unsupported.

  16. Minecraft Snapshot 24w09a

    If set, the item will not lose any durability when used; Replaces Unbreakable boolean tag; Format: object with fields. show_in_tooltip: boolean (default: true) If true, an 'Unbreakable' line will be included in the tooltip; Replaces 3rd bit of HideFlags tag; e.g. unbreakable={}, unbreakable={show_in_tooltip:false} minecraft:enchantments

  17. Built-ins for numbers

    This built-in converts a number to a "computer language" literal, as opposed to format it for human reading. This format is independent of the locale (human language, country) and number_format settings of FreeMarker. Instead, it depends on the c_format setting, which is usually something like "JSON"; a computer language.

  18. Testing variable of boolean type in Freemarker

    1. That's incorrect, at least without using some strange custom ObjectWrapper. boolean isOffline () (or boolean getOffline ()) defines the JavaBean property called "offline", so you can access its value in FreeMarker like websetting.offline, without is and (). OTOH if your Java method is boolean offline (), then you will not conform to the ...

  19. Handling null values in Freemarker

    This works for strings, sequences, hashes or collections. If the object is a date, boolean or a number, then it acts as non-empty. For all other types it will act as empty. ... How to set null to a variable in freemarker. 3. Freemarker Default Value if NULL. 1. Freemarker: how to specify the value "null" in an expression? 1.