java - Get value from HashMap using JSTL and variable as an argument -


i have hashmap , trying value it, using variable argument. here code

<c:foreach var="t" items="${usertasks}">         <tr>             <td>${t.task}</td>             <td><${t.deadline}</td>             <td>${difficultymap[${t.difficulty}]}</td>             <td>${t.done}</td>         </tr>     </c:foreach> 

difficultymap - hashmap, t.difficulty - integer value. error

pwc6038: "${difficultymap[${t.difficulty}" contains invalid expression(s): javax.el.elexception: error parsing: ${difficultymap[${t.difficulty}

${difficultymap[1]} works ok, need use variable argument, possible?

get rid of nested ${}. this:

<td>${difficultymap[t.difficulty]}</td> 

el expressions delimited using leading dollar sign ($) , both leading , trailing braces {}.

since you're working within expression, don't have create el expression access variable.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -