Use request.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. The following example demonstrates it: URL http://www.host.com/servlets/HelloEcho/extra/info?height=100&width=200 getRequestURI /servlets/HelloEcho/extra/info getServletPath /servlets/HelloEcho getPathInfo /extra/info getQueryString height=100&width=200 This is useful if your [...]
Filed under: 1 | Leave a Comment »