tags:

views:

179

answers:

1

Given the following Portlet Code:

ArrayList nameList = new ArrayList();
nameList.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 ....

+1  A: 

<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.
BalusC