Hi Urs,
The example you gave in your first comment already had the xssAPI instance so I assumed you already have access to it.
However, if you don't, you could either include <%@include file="/libs/granite/ui/global.jsp" %> or alternatively add <%@taglib prefix="cq" uri="http://www.day.com/taglibs/cq/1.0" %> in your jsp.
And in case you are asking how to use it within the script in your jsp, attaching a sample below :
<script>xyz.registerConfig("serverUrlConfig", {"contextPath" : "<%=xssAPI.encodeForJSString(contextPath)%>" } );</script>
Hope that helps.
Thanks,
Anshika