I have the following code in my JSP:
<c:set var="myBoolean" value="item.lock${myappli.code.value()}"/>
<c:out value="${myBoolean}"/>
<c:out value="${requestScope[myBoolean]}"/>
In item i have several booleans lockCode1, lockCode2, .... so I use the firs line of code to get the string "item.lockCode1", "item.lockCode2". This expression (item.lock${myappli.code.value()}) works fine. I use it to create my checkboxes:
<form:checkbox path="item.lock${myappli.code.value()}" value="item.lock${myappli.code.value()}" />
Now what i would like is to evaluate the value of "item.lockCode1", "item.lockCode2", .... so that i get the value of the boolean lockCodeX.
When i write
<c:out value="${myBoolean}"/>
it displays: item.lockCodeX
I found the third line on stackoverflow :
<c:out value="${requestScope[myBoolean]}"/>
which i hoped would evaluate "item.lockCodeX" and give me 'true' or 'false', that is its value. But it doesnt work. How could i get my expression "item.lockCodeX" to be evaluated to true/false?
Thanks, E.
PS: My ultimate goal is that I want to (des)activate the checkbox according to the value of the boolean item.lockCodeX. So I thought about something like that:
<c:choose>
<c:when test="here evaluate my expression to true/false">
<form:checkbox path="item.lock${myappli.code.value()}"
value="item.lock${myappli.code.value()}" disabled="false"/>
</c:when>
<c:otherwise>
<form:checkbox path="item.lock${myappli.code.value()}"
value="item.lock${myappli.code.value()}" disabled="true"/>
</c:otherwise>
</c:choose>
PS2: I cant use a map, the code is like that, I cant change it.
PS3: I have tried to write:
<c:when test="item.lock${myappli.code.value()}">
and
<c:when test="${item.lock${myappli.code.value()}}">
but it doesnt work.
PS4: Here is the relevant lines of the object item:
public class Lot extends BaseEntite {
...
private Boolean lockBEL;
private Boolean lockPAR
private Boolean lockCIA;
private Boolean lockAFA;
private Boolean lockLO;
...
In my Controller I get the object from a webservice and I put it in my ModelAttribute searchForm:
searchMetier.getResultsSearch(context, this.formToDemand(searchForm));