Hi,
i have to get the servletcontext name in my application.
Eg:
http://localhost:8080/myapplication/index.jsp, here i have to get the servletcontext/webapp name (i.e. myapplication) in my app. But here, i should not use request.getContextPath(); as this comes from the browser URL. The reason is, For my application i am not giving the direct URL of server to client. Client access the application from a proxy. So, in my application i can't take this servletcontext name from the browser.
For this, i am doing this :-
in deployment descriptor (web.xml)
i have given the tag as,
<web-app>
<display-name>myapplication</display-name>
- - -
- - -
</web-app>
In JSP, to get the servletcontextname i am using this:
request.getSession(false).getServletContext().getServletContextName();
Is any other way to get servletcontext name, because in the way which i have mentioned i should give the name compulsory in deployment descriptor file.
Please let me know if any other choices. Thanks in advance.....