This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes forward in a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "forward in a servlet" Watch "forward in a servlet" New topic
Author

forward in a servlet

Javed Mohammed
Greenhorn

Joined: Sep 29, 2005
Posts: 17
Hi,

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
loclahost:8080/webApp/Login.jsp

when the servlet is forwarding, the url in the address bar is displayed as
http://it-laptop2:8080/webApp/servlet/controlerservlet

insted of
loclahost:8080/webApp/Login.jsp

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
Marshal

Joined: Jan 10, 2002
Posts: 56179
    
  13

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


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ben Souther
Sheriff

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: 1506
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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Javed Mohammed
Greenhorn

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forward in a servlet
 
Similar Threads
Servlets example
Java Servlets
HTTP method POST is not supported by this url
HTML username password sending to servlet
Using Filters with Struts