wood burning stoves 2.0*
The moose likes Servlets and the fly likes request.getRequestURI() problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getRequestURI() problem" Watch "request.getRequestURI() problem" New topic
Author

request.getRequestURI() problem

chandramohan sampath
Greenhorn

Joined: Aug 23, 2001
Posts: 2
Hi all,
I am using request.getRequestURI() to get the url of the calling page.
But, Can anyone let me know how do i get the complete url.
eg: if http://localhost:8080/servlet/abc.jsp?abc=12324&xyz=5830 is the url of the page.
when i use request.getRequestURI() I get only http://localhost:8080/servlet/abc.jsp.
But, I need to get the values of abc and yxz parameter also.
Can anyone let me know about it.
thanks a lot
chandru
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Hi Chandru,
You can get the entire URL back by concatenating the following items :
(1) the url, accessed by request.getRequestURL()
(2) followed by a question mark character (?)
(3) and finally the query string, accessed by request.getQueryString()
If it's just the values of abc and xyz you need, these can be accessed by using the getParameter() method. For example :
request.getParameter("abc");
request.getParameter("xyz");
Hope that helps..
Simon
------------------
Simon Brown
Co-author of Professional JSP 2nd Edition
[This message has been edited by Simon Brown (edited August 23, 2001).]
chandramohan sampath
Greenhorn

Joined: Aug 23, 2001
Posts: 2
Hi simon,
Thanks a lot.
It's working for me.
regards
chandru
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: request.getRequestURI() problem
 
Similar Threads
tomcat4
How to make a web project in My eclipse 4.1
Migration from Tomact to JBOSS
Tomcat - URL patterns
how to know the last page visited?