开发者

Item value in JSTL foreach loop not working in Portlet

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:

  1. Application server in question doesn't support JSP 2.0.
  2. The web.xml is not declared as Servlet 2.4 or higher.
  3. The @page is configured with isELIgnored=true.
  4. The web.xml is configured with <el-ignored>true</el-ignored> in <jsp-config>.

To fix one or other, obviously do:

  1. Upgrade server or use JSTL c:out instead and live with it.
  2. Preferably declare web.xml to latest Servlet API version supported by appserver.
  3. Remove the isELIgnored=true attribute.
  4. Remove the <el-ignored>true</el-ignored> entry.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜