Again, your js files are all loaded by the browser when the page is assembled. They're not interpreted as separate entities.
Lets suppose you have some code in a js file named ext.js. In that file there are functions that need the contextPath of your application. Assign the value of your contextPath to a variable, then import the file and that variable will be available to the functions in that file.
Now in your JSP page: