I want to access any index of a HashMap to retrieve an Id
through this code:
th:text="'Network Id: ' + ${poolHashrates[0].key.networkHashrate.id}"
poolHashrates
is a HashMap
,
networkHashrate
is a separate variable in key
variable
Basically, all the networkHashrates
in key
have the same Id
, so I could actually access any element, no matter what the index is.
I've also tried:
th:text="'Network Id: ' + ${poolHashrates.get(key).networkHashrate.id}"
th:text="'Network Id: ' + ${poolHashrates['key'].networkHashrate.id}"
None of these works. I keep getting
Exception evaluating SpringEL expression: "poolHashrates['key'].networkHashrate.id"
or
SpelEvaluationException: EL1007E: Property or field 'networkHashrate' cannot be found on null
I was able to print the Id
in Intellij console, so it apparently exsists.