javajstljstl-functions

How to print random value next to original value using jstl?


I am using JSTL to push the CSS in HTML pages like if CSS name is abc.css I want to append timestamp next to CSS due to caching issue abc.css?time=21223233232 using JSTL

<c:forEach var="css" items="${styles}">
    <link type="text/css" rel="stylesheet" href="/<c:url value="${css}"/>" />
</c:forEach>

Currently, I am using this way to push CSS to HTML page how can I use the same code to append timestamp parameter?


Solution

  • You need to get the base URL and the time-part as variables. Then you´ll have to "concatenate" that, like ...href="${css}?time=${time}"/>