Given the following Portlet Code:
ArrayList nameList = new ArrayList();
nameLis开发者_C百科t.add("Willi Willisch");
nameList.add("Seppi Seppisch");
renderRequest.setAttribute("names", nameList);
And the following JSP Code:
<c:forEach var="aName" items="${names}">
<tr>
<td>${aName} </td>
</tr>
</c:forEach>
Prints out:
${aName}
${aName}
I don't have any clue why a $(aName) isn't evaluated. The forEach loops works, because ${aName} is printed out twice ....
<c:out value="${aName}"/>
works!! But shouldn't${aName}
work aswell?
Thus, "EL in template text" doesn't work? That can have one or more of the following causes:
- Application server in question doesn't support JSP 2.0.
- The
web.xml
is not declared as Servlet 2.4 or higher. - The
@page
is configured withisELIgnored=true
. - The
web.xml
is configured with<el-ignored>true</el-ignored>
in<jsp-config>
.
To fix one or other, obviously do:
- Upgrade server or use JSTL
c:out
instead and live with it. - Preferably declare
web.xml
to latest Servlet API version supported by appserver. - Remove the
isELIgnored=true
attribute. - Remove the
<el-ignored>true</el-ignored>
entry.
精彩评论