Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how one servelet call another servelet with define http method.

 
rajnish chattha
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i want to call a servlet from another servlet.I tried it using request dispatcher
String destination="/login";

RequestDispatcher rd = getServletContext().getRequestDispatcher(destination);
rd.forward(request,response);
By doing above..it calls the doPost method of /login servelet and display name of current servlet as URL.
I want that as soon as Requestdisatcher get execute then www.//domainname/login url should appear as login URL.
How it can be done in java..am quite new java technology..!
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you wanted to display the log in page with URL change then use

It will change the current servlet name to redirect servlet name in the URL.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is the URL in the address bar important?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic