Th" /> Th" /> Th"/>

conditional expression in jsp inside input tag

722 Views Asked by At
<input type="text" name="${task.getTaskId()}today" placeholder="${tm.get(LocalDate.now()).contains(task.getTaskId()) ? 'saved' : 'dosa'}" size="2">

This is my code situated inside a <c:forEach items="${tasks}" var="task" >. tm is a HashMap<LocalDate,List<String>> I tried the same code in a java file it works. But in jsp it doesn't. I always get dosa which implies the condition is false. Why is this ?

1

There are 1 best solutions below

0
Angelo Oparah On

It might not fully answer your question, but as far as I know to access a property or field or instance var in EL you don't use Java getter methods but the "." notation or the square brackets.

So for instance while in Java you would go

task.getTaskId()

In EL that would be

task.taskId

or

task['taskId']

Then I would probably check if there's a JSTL function that can check if a value is contained in a map