program for RequestDispatcher in servlets?

Answer Posted / sudhakar

import javax.servlet.*;
import javax.servlet.http.*;

public class TestDispatcher extends HttpServlet throws
IOException, ServletException {
public void doGet(HttpServletRequest request,
HttpServletResponse response) {
RequestDispatcher dispatcher =
request.getRequestDispatcher("/template.jsp");
dispatcher.forward(request, response);
}
}

Is This Answer Correct ?    17 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the important functions of filters?

605


What is the difference in between the httpservlet and generic servlet?

618


How to find whether a parameter exists in the request object?

673


What is Servlet API used for connecting database?

622


Once the destroy() method is called by the container, will the servlet be immediately destroyed? What happens to the tasks(threads) that the servlet might be executing at that time?

784






What is Client-Server Computing?

1905


What are the ways to handle multi-threading in servlets?

605


How can you push data from an Applet to a Servlet?

617


How the typical servlet code look like ?

643


What are the life cycle methods of the servlet?

590


Why is Servlet so popular?

618


Difference between doget and dopost?

686


What are different methods of session management in servlets?

785


What do you mean by the servlet chaining?

558


What is the procedure of invoking different servlet in a different application?

569