1, Request.getrequesturl ()
The full URL is returned, including the HTTP protocol, port number, servlet name, and mapping path, but it does not contain the request parameters.
2, Request.getrequesturi ()
I get a partial value of the request URL, and the Web container has no decode
3, Request.getcontextpath ()
Return to the context of the request.
4, Request.getservletpath ()
Returns a partial URL to the calling servlet.
5, Request.getquerystring ()
Returns the query string after the URL path
Example:
Current URL:HTTP://LOCALHOST:8080/CARSILOGCENTER_NEW/IDPSTAT.JSP?ACTION=IDP.SPTOPN
Request.getrequesturl () http://localhost:8080/CarsiLogCenter_new/idpstat.jsp
Request.getrequesturi ()/carsilogcenter_new/idpstat.jsp
Request.getcontextpath ()/carsilogcenter_new
Request.getservletpath ()/idpstat.jsp
Request.getquerystring () action=idp.sptopn
Request Get URL