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 is servlet collaboration?

1141


How can you start a jta transaction from a servlet deployed on jboss?

1159


What is meant by Servlet? What are the parameters of service method?

1052


Explain load on start-up and its importance?

1131


Can you use javascript in servlets?

1079


What is the process for chaining servlet?

1047


Explain servlet life cycle?

1125


What is a servlet?

1137


What is servlet instance?

1047


How will two or three servlets interact or communicate with each other?

1445


Which HTTP method is non-idempotent?

1128


I have a requirement Here we have a ResultSet object that will contain 50 records i need to print those recors in to a webpage(i.e; view according to MVC architectures that mybe servlet or jsp) . Here i need to print the records 10 per page that is 1 to 10 in page one and 11 to 20 in page two like remaining will be appeared in other pages we need to display those page numbers whenever we click on that page number we will go to that page and display 10 records like we will display 5 pages it is like this << 1 2 3 4 5 next >>

2962


Define context initialization parameters.

1031


Is java servlet still used?

1040


What are the different methods of session management in servlets?

1007