Skip to content
Advertisement

Do we have to add any configurations to get Java object data into freemarker template?

Do we have to add any configurations to get Java object data into freemarker template ? In my template while using ‘If’ condition as shown below

JavaScript

Getting this error below

JavaScript

FYI: searchForm and frm_searchType are public. If these two are initially null and will be getting data later, then how to get the template rendered initially.

Advertisement

Answer

If they are initially null, you should define default values for this case. From manual “Handle missing values”:

JavaScript

This will handle if product.color is missing. That is, if product is missing, or product exists but it does not contain color, the result will be “red”, and no error will occur.

So what should work is:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement