Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the use of RequestDispatcher in servlet?

Answer Posted / kollu sreenivasa rao

When you want send your request to another servlet/jsp from
your servlet, we can use RequestDispatcher.

There are two ways to get reference of RequestDispatcher.

1)If you get requestdispatcher reference from
ServletContext, you have to specify the absolute url as
argument in getRequestDispatcher method like below.

RequestDispatcher dispatcher =

getServletContext().getRequestDispatcher("/my_other_app/servlet/SomeServlet");
dispatcher.forward(request, response);

2)If you get requestdispatcher reference from
ServletRequeset, you have to specify the relative url as
argument in getRequestDispatcher method like below.

RequestDispatcher dispatcher =
request.getRequestDispatcher("SomeServlet");
dispatcher.forward(request, response);

Is This Answer Correct ?    18 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the benefits of using servlet over cgi?

1072


what is multiple server?

2315


How can we invoke another servlet in a different application?

1217


Difference between get and post in java servlets?

1042


Tell us something about servletconfig interface.

1008


What is servlet? Explain

1068


How do you find out what client machine is making a request to your servlet

1062


What are the types of an http request?

1158


What is difference between get and post method?

1086


Is dispatcher servlet a singleton?

1021


Explain the difference between jsp and servlet?

1092


What is meant by cookies?

1082


How is the get () method different from the post() method?

977


What are the different mode that servlets can be used?

1022


Can a jsp be called using a servlet?

1144