Use req.getRequestURI() or req.getServletPath(). The former returns the path to the script including any extra path information following the name of the servlet; the latter strips the extra path info. For example:
URL http://www.javasoft.com/servlets/HelloServlet/jdata/userinfo?pagetype=s3&pagenum=4
getRequestURI ------------ servlets/HelloServlet/jdata/userinfo
getServletPath ------------ servlets/HelloServlet/
getPathInfo ------------ /jdata/userinfo
getQueryString ------------ pagetype=s3&pagenum=4
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment