Reputation: 3
I'm trying to do something like this:
<script type="text/javascript" src="<c:out value="${jsDirectory}javascript/StoreCommonUtilities.<tag:versionnumber/>js"/>"></script>
Where <tag:versionnumber/>
is a custom JSP tag that works on its own. Currently, it just literally prints out "<tag:versionnumber/>"
. Any help is appreciated.
Upvotes: 0
Views: 1355
Reputation: 692081
<c:out>
is used to escape special HTML characters (<
, >
, &
, '
and "
). I sure hope you don't have those characters in the jsDirectory
attribute. So there's no reason to use <c:out>
:
<script type="text/javascript" src="${jsDirectory}javascript/StoreCommonUtilities.<tag:versionnumber/>js"></script>
That said, if you want to use the value of <tag:versionnumber>
in other tag attributes, you should create an EL function instead of a tag, or make it possible to store the result in a page-scope attribute, as <c:set>
does:
<tag:versionnumber var="version"/>
<c:out value="${version}"/>
Upvotes: 2