Fernando Mendez
Fernando Mendez

Reputation: 19

I have an null error on FreeMarker template.process, but the map is evaluated

I have a oribkem with freeMarker template.process(tempName, Map<String, Object> valueMap)

freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> entity  [in template "myTemplate.html.ftl" at line 128, column 56]

FTL stack trace ("~" means nesting-related):
- Failed at: #if entity.has("firstValue")  [in template "myTemplate.html.ftl" at line 128, column 51]

On debug my map is evaluated, but for the parser appear with null value.

I use FreeMarker 2.3.30

Thank yiu

Upvotes: 0

Views: 1018

Answers (1)

Cortex
Cortex

Reputation: 684

Problem is in entity.has("firstValue"): This is not the correct Freemarker syntax.

To access builtin use ? instead of ., also Freemarker doesn't have the builtin has for hashes. Refer to: https://freemarker.apache.org/docs/ref_builtins_hash.html

Upvotes: 0

Related Questions