I have a servlet that looks something like this:
public class ExampleServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServ
The URL the user (browser) requested can be accessed from the request by:
request.getRequestURL()
Alternatively the request has a whole bunch of accessors to get the various pieces of the URL as well as those on ServletRequest.
To redirect to a different URL change the response rather than the request:
response.sendRedirect(theURLToRedirectTo)