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’s the difference between sendredirect and forward methods

578


What do you mean by web applications?

643


Why do you use session tracking in httpservlet?

651


How do you run a servlet?

552


If a servlet is not properly initialized, what exception may be thrown?

641






What are the steps involved in placing a servlet within a package?

599


How to read request headers from servlets?

576


What are the advantages of Servlet over CGI?

680


How will two or three servlets interact or communicate with each other?

932


How can you create a session in servlet?

608


What is generic servlet class?

611


What are the different types of servlets?

532


What is difference between server and servlet?

593


What if you need to span your transaction across multiple servlet invocations?

593


What is the difference between Difference between doGet() and doPost()?

765