How to get the base url from the jsp request object?
http://localhost:8080/SOMETHING/index.jsp, but I want the part till index.jsp, how is it possible in jsp?
How to get the base url from the jsp request object? http://localhost:8080/SOMETHING/index.jsp , but
Share
So, you want the base URL? You can get it in a servlet as follows:
Or in a JSP, as
<base>, with little help of JSTL:Note that this does not include the port number when it’s already the default port number, such as 80. The
java.net.URLdoesn’t take this into account.See also: