getRequestURI() Method Of The Request Object
This section gives you the detailed explanation of the getRequestURI() method of the request object in JSP. This method is used for getting the information of the URI of the current page of your JSP application. This method returns the URI of the current page from the URL (Unified Resource Locator). The retrieved URI is the string which is mentioned in the URL after the host name up to the current page. The retrieved URI does not contain the host name or any parameter mentioned from the query string after the page name in the URL.
This section also provides an example of JSP with the complete code which gives you the URI of the current page. You can directly put the code in your JSP application for getting URI as per requirement.
Here is the code of the GetRequestURIMethod.html file:
Output for the GetRequestURIMethod.html file:
Here is the JSP code of the GetRequestURIMehtod.jsp file:
Output for the above mentioned JSP file: