File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes forward in a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "forward in a servlet" Watch "forward in a servlet" New topic

forward in a servlet

Javed Mohammed

Joined: Sep 29, 2005
Posts: 17

I just started a web app with login jsp and a servlet. When the login is successful, user should get a welcome message,
other wise login page should be displayed with error message. This is working fine except for one small glitch.

my login URl is

when the servlet is forwarding, the url in the address bar is displayed as

insted of

Is this normal or am I doing something wrong?

I am using Tomcat 6 server and my servlet code looks like this.....

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

As this is not Tomcat-specific, it has been moved to the Servlets forum.

[Asking smart questions] [About Bear] [Books by Bear]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

A forward doesn't change the URL in the address window at all.
Can you post the page containing the login form?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
As already mantioned, forwarding occurs on the backend and the user is not aware that it happened since teh URL remains the same. i.e in this case controllerServlet.

So much trouble in the world -- Bob Marley
Javed Mohammed

Joined: Sep 29, 2005
Posts: 17
okay, I thnk I got it.

Sicne the foward does not change the URL, it is stying the same on the browse. I guess I was concerned for no reason. As mentioned earlier, the app is working fine

Thank ya'all for the help.
Don't get me started about those stupid light bulbs.
subject: forward in a servlet
It's not a secret anymore!