How to get url of current request from HttpServletRequest? for example "http://site/index.jsp?id=1"

Alex Chaffee

Try

String getFullURL(HttpRequest request) {
 StringBuffer url = request.getRequestURL();
 if (request.getQueryString() != null) {
  url.append('?');
  url.append(request.getQueryString());
 }
 return url.toString();
}
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact