Testing Which Page Loaded your JSP Page Fragment

Zen Water on Flickr

Zen Water by darkpatator

Sometimes you want to check in your JSP page fragment which page loaded it.  Fortunately this is simple with JSTL.

[xml]<c:if test="${fn:indexOf(pageContext.request.requestURI,’foo.jsp’) != -1}">
The request URI ${pageContext.request.requestURI} contains foo.jsp.
</c:if>[/xml]

Simple but something I always forget how to do. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *