I want to understrand what happens when i use JSTL to access maps,in Hidden features of JSP/Servlet in @blausC's answer, he explained what happend, but when i try to use the following code
<c:set var="resultMap" value="validationResults" scope="request"></c:set>
<c:if test="${resultMap['userName'] != null}">
${resultMap['userName'].details}
</c:if>
a confused exception happend
Caused by: javax.el.PropertyNotFoundException: Property 'userName' not found on type java.lang.String
The key of the map should be string, so whay is this exception, i tried the examples in the above question and the same exception,Can some one tell me where I have misunderstanding?
Edit: I populate the map in the servlet and send it to jsp
Map<String, ValidationResult> result = new HashMap<String, ValidationResult>();
aValidationResult = new ValidationResult();
check whether the field is valid or not if not fill the map
result.put("userName", aValidationResult);
result.put("group", aValidationResult);
if map is not empty, return the map to jsp
request.setAttribute("validationResults", result);
the map is filled when i make server side validation ,
Thanx in advance.