Search code examples
javajspjstlhref

How do I add a anchor to a HREF in JSTL?


I was wondering how I go about adding a anchor to a HREF in JSTL. I've tried googling it and am no further forward really, I tried adding it as a PARAM but to no avail. My current code is like this;

<a href="${myUrl}#address">My URL</a>

But my code fails to validate and my server Error 500's. Could someone explain to me how to successfully an anchor to my HREF please?


Solution

  • I figured it out, but if there is a better way of doing it, please let me know ;)

    I have this code in place, the dynamic bit is inside of a Mustache template;

    <c:url value="/myURL#" var="myUrl"/>
    <a href="${smyURL}{{address}}">My URL</a>