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 source code for include() & forwrd() method
servlet program?



What is the source code for include() & forwrd() method servlet program?..

Answer / sunny

1. forward should be called before the response has been
committed to the client.

public class Dispatcher extends HttpServlet {
public void doGet(HttpServletRequest req,
HttpServletResponse res) {
RequestDispatcher dispatcher =
request.getRequestDispatcher
("/template.jsp");
if (dispatcher != null) dispatcher.forward
(request, response);
}
}

2. Includes the content of a resource (servlet, JSP page,
HTML file) in the response.

public class Dispatcher extends HttpServlet {
public void doGet(HttpServletRequest req,
HttpServletResponse res) {
RequestDispatcher dispatcher =
getServletContext
().getRequestDispatcher("/banner");
if (dispatcher != null) dispatcher.include
(request, response);
}
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More JavaScript Interview Questions

What is MEAN in javascript

1 Answers  


Which is the best website to learn javascript?

0 Answers  


Which built-in method adds one or more elements to the end of an array and returns the new length of the array?

0 Answers  


How do I open javascript?

0 Answers  


What are different types of popup boxes available in javascript?

0 Answers  


What is NaN in Javascript?

0 Answers  


why you used Java Script? Can it use for both client side and server side validation purpose?

12 Answers   BeBo Technologies, HCL, Wipro,


How do you write an event emitter base class that allows you to add event listeners?

0 Answers  


Can you put javascript in html?

0 Answers  


Are javascript variables global?

0 Answers  


Why is currying called currying?

0 Answers  


What is the main difference between Client side JavaScript and and Server side Java Script?

7 Answers   Ramco,


Categories