Monday, 15 February 2010

thymeleaf - throwing error when trying to access hashmap with key with a numeric value or special chars -



thymeleaf - throwing error when trying to access hashmap with key with a numeric value or special chars -

throwing error when trying access hashmap key numeric value or special chars here code trying use:

<div th:include="${mymap[__${dept.code}__]}"/>

if code has letters , works fine, if holds numeric value "1234" , fails .

appreciate resolution on this. thanks..

if map based on string keys shpuld ensure precomputed look string.

a textliteral look can consist of limited type of characters. a-z, underscores, minus , others.

to ensure it's string can wrap precomputed look in single quotes:

<div th:include="${mymap['__${dept.code}__']}"/>

thymeleaf

No comments:

Post a Comment