Search code examples
htmljspjstlhref

Jslt c out in a href


How should I write line:

<a href="User?id=<c:out value="${user.id}" />" >Profile</a>

correctly? It shoult give me something like Profile

My context:

<c:forEach items="${requestScope.users}" var="user">
    <tr>
    <td><c:out value="${user.login}" /></td>
<td><c:out value="${user.name}" /></td>
    <td><c:out value="${user.lastname}" /></td>
    <td><a href="User?id=<c:out value="${user.id}" />" >Profile</a></td>
    </tr>
</c:forEach>

Solution

  • Try ' inside " or vice versa

    <a href="User?id=<c:out value='${user.id}' />" >Profile</a>