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

How to get value of an element by class in javascript ?

0 Answers  


What is the syntax of ‘self invoking function’? Give an example?

0 Answers  


what is inheritence

6 Answers   Verifone, Wipro,


What is new function in javascript?

0 Answers  


When do we use JSON.stringify()?

0 Answers  


How can I request data from the server without reloading the page in the browser?

0 Answers  


What is are the types of the pop up box es available in javascript?

0 Answers  


What are types of javascript?

0 Answers  


What is difference between javascript and jscript?

0 Answers  


How do you check if an object is an array or not?

0 Answers  


If 2 methods have same name and same number of parameters, which one will be executed first?

0 Answers  


How do you write an if statement in javascript?

0 Answers  


Categories