I wish to get the current url minus the file name that is being currently referenced. Whether the solution is in JSP or CQ5 doesn't matter. However, I am trying to use the latter more to get used to it.

I'm using this documentation but it's not helping. [CQ5 Docs](http://dev.day.com/docs/en/cq/5-3/javadoc/com/day/cq/wcm/api/PageManager.html).
The example I found retrieves the full current path, but I don't know how to strip the file name from it:

```
<% Page containingPage = pageManager.getContainingPage(resourceResolver.getResource(currentNode.getPath()));
%>
<a href="<%=containingPage.getPath() %>.html">Profile</a>

```