When my JSP returns, it loads a JavaScript that serves as a form action when a button is clicked. This JavaScript includes a request.open() call, with the URL it needs to pass as a peer of the JSP that loaded it. The URL must be the one that was originally called. For instance, if a.jsp loads the following JavaScript:
function doSomething() { var path = "some url" + "/b.jsp?" + "params"; var request = new XMLHttpRequest(); request.open("POST", path, true); ...
In cases where I am testing a.jsp with a direct call to "http://localhost/context/a.jsp" or in an environment that redirects calls to a server not accessible from a web browser, I would like the JavaScript to use the prefix of the URL that called a.jsp before making a call to b.jsp.
Thank you