This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes how one servelet call another servelet with define http method. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how one servelet call another servelet with define http method." Watch "how one servelet call another servelet with define http method." New topic
Author

how one servelet call another servelet with define http method.

rajnish chattha
Greenhorn

Joined: Dec 01, 2011
Posts: 3
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

Joined: Jul 05, 2008
Posts: 166

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.


No pain, No gain.
OCJP 1.6
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Why is the URL in the address bar important?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: how one servelet call another servelet with define http method.
 
Similar Threads
Help needed to 'Forward' Servlet to Servlet
Request needs to be POST In servlet
How to retrieve generated HTML
Calling Servlet from a java class
Threads/pooled sessions and cache