У меня есть hashmap, который хранится в сеансе.HashMap - это карта карт.
HashMapStoredInSession ={"290" = {text="abc", response="someText"}, "276"={text="xyz", response="random"}};
Я не хочу использовать скриптлеты.Но я застрял с одним скриптлетом и не могу заставить его работать.Любые предложения, где я иду не так, было бы здорово.Следующая комбинация SCRIPTLET + JSTL работает
Scriptlet:
<%
Map hMap= (Map)request.getSession().getAttribute("HashMapStoredInSession");
pageContext.setAttribute("mapofMaps", hMap);
%>
JSTL код:
<c:if test="${param.ID != 'null' && not empty param.ID}">
<c:set var="someID" value="${param.ID}" scope="session"/>
</c:if>
<c:forEach items="${mapofMaps}" var="outerMap">
<c:if test="${outerMap.key == someID}"> // this is the line where exception is thrown when the above scriptlet code is replaced with JSTL below
<c:forEach items="${outerMap.value}" var="innerMap">
<c:if test="${innerMap.key == 'param1'}">
<c:set var="response1" value="${innerMap.value}"/>
</c:if>
<c:if test="${innerMap.key == 'param2'}">
<c:set var="response2" value="${innerMap.value}"/>
</c:if>
</c:forEach>
</c:if>
</c:forEach>
Сейчасесли я пытаюсь заменить код скриптлета следующим (без изменений в коде JSTL)
<c:set var="mapofMaps" value ='<c:out value ="<%=request.getSession().getAttribute("HashMapStoredInSession")%>"/>'/>
, я получаю следующую ошибку
An error occurred while evaluating custom action attribute "test" with value "${outerMap.key == someID}":
Unable to find a value for "key" in object of class "java.lang.String" using operator "." (null)