How do I correct this statement:
${model.myHashtable[model.data.id]}.
myHashtable is defined as
Hashtable<String, String>
But, ${model.data.id}
returns an int
.
I tried to do something like
${model.myHashtable['model.data.id']}
But it does not work. Any other ideas, aside from changing the type of id
to String
?
Set it as body of <c:set>
. It will implicitly be converted to String
.
<c:set var="idAsString">${model.data.id}</c:set>
<c:out value="${model.myHashtable[idAsString]}" />
${''.concat(model.data.id)}
works for me,you may try it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With