I have this variable ${baseURL}
which is set like so
<c:set var="baseURL" value="${fn:replace(pageContext.request.requestURL,
pageContext.request.requestURI, pageContext.request.contextPath)}" />
I need to assign it to a Java String or pass it into a Java function within the same jsp file.
You can assign a JSTL variable to a JAVA variable by getting its value using pageContext.getAttribute()
method as follow:
<% Strig s = (String)pageContext.getAttribute("baseURL"); %>