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 |
Name some of the built-in methods and the values returned by them.
What is meant by object oriented programming?
Write a Program using Servlet and JDBC for developing online application for displaying the details of Cars owned by the residents in XYZ society. Make necessary assumptions and create appropriate databases
What is javascript namespacing?
What is namespacing in javascript and how is it used?
Can you have a function within a function in javascript?
How to create an input box?
Is javascript necessary?
what will happen and why if i will acess the methods of superclass which is declared as private by a object of same subclass.
Is javascript case sensitive language?
What does unshift() function do in Javascript?
How to show progress bar while loading using ajax call?