Answer Posted / avinah kapoor
import javax.servlet.*;
import javax.servlet.http.*;
public class RequestDispatcherDemo extends HttpServlet
{
public void doGet(HttpServletRequest
req,HttpServletResponse res) throws ServletException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
RequestDespatcher rd=req.getRequestDispacher("welcome");
rd.forward(req,res);//it forwart the response to
welcome servlet page but cant take resource calling page.
}
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Why do we have servlet wrapper classes?
What are the differences between servlet context vs servlet config?
What is a servlet context object?
What is cgi and what are its drawbacks?
What is servlet initializer?
What is the difference between the include() and forward() methods?
Explain the working of service() method of a servlet.
What are the types of servlets? Explain
Explains the differences between context.getrequestdispatcher() and request.getrequestdispatcher()?
What are the uses of servlet
What is servlet invoker?
Which are the different ways you can communicate between servlets?
How can we upload the file to the server using servlet?
Difference between forward() method and sendredirect() method ?
what is the different between a servlet and a cgi? Why do you go for servlet rather than cgi?