I am in the process of changing all the paths in js files to prepend the context root to the paths.
I can get context path in the js by way of reading application.xml but that puts a restriction of not being able to read the application.xml from a relative path. Because application.xml is placed in META-INF which is not accessible to the outside world.
2nd way is i can include a header jsp in all the jsps and then have a common code like
var CONTEXT_ROOT = '<%= request.getContextPath() %>';
now we could refer to context_root in all the js files.