Search code examples
javajspjstljsp-tags

Calling a custom JSP tag from JSTL tag


I'm trying to call my custom tag from the JSTL tag <c:url>. Because of the quotes, the custom tag is shown as a string instead of a tag. Can I use an escape character here?

<img align="left" src="<c:url value='/getFile/getfile?<myTag:getValue type="web"  name="person" />'/>" alt="person" title="person" width="55" height="70"/>

Solution

  • You'll have to assign the output of your custom tag to a temp variable first and then use it

    <c:set var="urlquerystring"><myTag:getValue type="web" name="person" /></c:set>
    
    <img align="left" src="<c:url value='/getFile/getfile?${urlquerystring}'/>" alt="person" title="person" width="55" height="70"/>