I cant figure out why this is not working. Basicly the following code-snippet workes fine unless the c:if is true.
If the if-statement is true, then clientId should be set manually to 1. This does work, but for some reason then it will not fetch the clientProps.
ClientId=1 does work fine if it is fetched from the session-variable ‘user’. So clientProps should have something at spot 1.
Any clue?
<c:set var="clientId" value="${sessionScope['user'].client.clientId}"/>
<c:if test="${empty sessionScope['user'].client.clientId}">
True
<c:set var="clientId" value="1" />
</c:if>
<c:set var="clientProperties" value="${clientProps[clientId]}"/>
<c:set var="clientLogo" value="${clientProperties.clientLogo}"/>
<c:set var="clientURL" value="${clientProperties.clientWebURL}" />
clientId = ${clientId}
clientLogo = ${clientLogo}
clientURL = ${clientURL}
Result if user-object exists:
clientId = 1 clientLogo = /images/logos/Logo1.png clientURL = http://www.xxx.xxx
Result if user-object doesn exist:
True clientId = 1 clientLogo = clientURL =
This is setting it as a
Stringwhile the map key is apparentlyLong.You need to set it as a
Longinstead.Numbers in EL are implicitly treated as
Long, that’s why the above will work.