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 |
accessdenied javanet disconnet
What are the different functional component in javascript?
Explain window.onload and ondocumentready?
What is === in javascript?
How to empty an array in JavaScript?
What is null in programming?
a code in vb script, which creates a table of 5*2 in html this is a static table, one more same dynamic table, as we give input the table should get created.
Can you write a random integers function to print integers with in a range?
How to add new elements dynamically?
How do you round a value in javascript?
What does question mark mean in react?
How can javascript language be separated from objects?