How to use request.getcontextpath
Editor to share with you how to use request.getcontextpath, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Recently, there is a bit of confusion about several "paths" in requestgetcontextpath, and there is no good summary of finding online resources. I hope this article can help me understand these "paths".
How to get the path by requestgetcontextpath:
Request.getServletPath ()
Request.getPathInfo ()
Request.getContextPath ()
Request.getRequestURI ()
Request.getRequestURL ()
Request.getServletContext () .getRealPath ()
A simple example of requestgetcontextpath
Web.xml configuration (note the url-pattern entry here)
Aab
A.jsp
Test
Com.java.test.TestServlet
Test
/ *
The above is all the contents of this article "how to use request.getcontextpath". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!