javajspservletswcs

Get the full url of the current page in a JSPF


I have a url similar to this http://localhost/webapp/wcs/stores/servlet/ProductDisplay?expDataType=CatalogEntryId&catalogId=10351&urlRequestType=Base&productId=14311&expDataUniqueID=14311&errorViewName=ProductDisplayErrorView&urlLangId=-1&langId=-1&storeId=11001

How will I get the full url?

I have tried request.getURL.toString() , request.getQueryString() and request.getAttribute("javax.servlet.forward.request_uri").

but nothing gives the full path.

Can anyone help?


Solution

  • You can try this

     String completeURL = request.getRequestURL().toString() +"?"+ request.getQueryString();
    

    or customize as per your application.

    Even you can refer this : how to get full path of URL including multiple parameters in jsp

    Hope it helps, Thanks,