Frank Frank - 11 months ago 46
HTML Question

Spring URL not encoding correctly in JSP

I have the following HTML snippet that I'm including in several pages.

<td><a href="<c:url value="guestBook" /> "><img src="images/guestbook.jpg" alt="Guest Book" /></a></td>
<td><a href="<c:url value="polls" />"><img src="images/polls.jpg" alt="Polls" /></a></td>
<td><a href="<c:url value="graduation" />"><img src="images/graduation.jpg" alt="Graduation" /></a></td>
<td><a href="<c:url value="home" />"><img src="images/home.jpg" alt="Home" /></a></td>

In all of these pages except the graduation link, this gets translated as:

<td><a href="guestBook "><img src="images/guestbook.jpg" alt="Guest Book" /></a></td>
<td><a href="polls"><img src="images/polls.jpg" alt="Polls" /></a></td>
<td><a href="graduation"><img src="images/graduation.jpg" alt="Graduation" /></a></td>
<td><a href="home"><img src="images/home.jpg" alt="Home" /></a></td>

On the graduation page, the link is rendered as the original source code, i. e.
<a href="c:url value="...>
Can anyone help with this?


I forgot to include <%@ taglib prefix="c" uri=""%> in my code. When I put it in, everything worked.