Raging Goblin

2 May 2013

Spring Roo 7: JSTL

Filed under: Java,Spring Roo — Raging Goblin @ 08:02
Tags: , ,

Yesterday I tried to edit a Spring Roo generated view and used one of those handy constructs of the jstl (JavaServer Pages Standard Tag Library), the foreach loop:

<c:forEach items="${vmpadresses}" var="address">
   <input type="text" value="${address}" />
</c:forEach>

When I ran the page it threw a org.apache.jasper.JasperException to me with the message: The prefix “c” for element “c:forEach” is not bound. I thought what, no jstl?! But of course I was wrong, it is just not registered in the generated views. Look for the tag with all the other tag directives. In my case this was the div tag. Ad

xmlns:c="http://java.sun.com/jsp/jstl/core"

to this tag so that it reads something like this:

<div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:page="urn:jsptagdir:/WEB-INF/tags/form" version="2.0">

The dependency for the jstl is already in the pom, so this is all you have to do and all is fine again.

Create a free website or blog at WordPress.com.