Andrei Botalov Andrei Botalov - 1 year ago 62
Java Question

Servlets: sendRedirect is redirecting to incorrect url?

I run my app from Eclipse's Servers view. Currently urls that are shown to the user look like:


I haven't specified this EclipseProjectName anywhere in my files but it's present there.

Currently when I invoke
, then user is redirected not to
, but to

How do I solve that problem?

Answer Source

You should redirect to response.sendRedirect(request.getContextPath() + "/path"); But I don't know whether it's a correct way to do it

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download