Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


program for RequestDispatcher in servlets?

Answers were Sorted based on User's Feedback



program for RequestDispatcher in servlets?..

Answer / 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

program for RequestDispatcher in servlets?..

Answer / sonam

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.RequestDispatcher;
public class dispatcher extends HttpServlet throws
IOException, ServletException {
public void doGet(HttpServletRequest request,
HttpServletResponse response) {
RequestDispatcher dis=
request.getRequestDispatcher("welcome.jsp");
dis.forward(request, response);//it will go to ur
desired page.
dis.include("Hello java");//it will display ur
message also to ur desired page.
}


}

Is This Answer Correct ?    10 Yes 5 No

program for RequestDispatcher in servlets?..

Answer / 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

More Servlets Interview Questions

Which HTTP method is non-idempotent?

0 Answers  


What is Servlets and explain the advantages of Servlet life cycle?

0 Answers  


how can you give alias to servlets?

1 Answers  


how to use servlets with j2ee ?

2 Answers   Tech Mahindra,


What is SingleThreadModel interface?

0 Answers  


How does Cookies work in Servlets?

0 Answers  


What is a generic servlet?

0 Answers  


Who is responsible for writing a constructor?

0 Answers  


Explain the difference between a web server and a web container?

0 Answers  


What is new in ServletRequest interface ? (Servlet 2.4)

0 Answers  


What is the first statement in jsp page.

7 Answers   L&T,


What do you mean by cgi in servlet?

0 Answers  


Categories