Someone please HELP ME.
private void forward(String address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException{
getServletContext()
.getRequestDispatcher("/" + address)
.forward(request, response);
}
private void include(String address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException{
getServletContext()
.getRequestDispatcher("/" + address)
.include(request, response);
}
These two functions have been written in every servlet in my project and the problem is that when I have used these two functions in a servlet at first include("servlet/abc",request.response); and after it have used forward("servlet/def",request.response); so using Netbeans 7 I have step by step watched that forward is not forwarding the control of servlet but when I don't use include before the forward its forwarding the control.
So I want to know that why it is happening and what's the reason and how can I do forward after include any servlet.
Please someone HELP ME ...it's an interesting question.
include("servlet/abc",request, response);
forward("servlet/def",request, response); //HERE IS PROBLEM NOT FORWRDING AFTER INCLUDE