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?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is servlet initializer?

1033


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

1358


What's the difference between servlets and applets?

1096


What is the dispatcher servlet?

1030


Which exception is thrown if the servlet is not initialized properly?

1088


What’s the difference between genericservlet and httpservlet?

1188


What is the use of httpservletrequestwrapper?

1145


What is the difference between using getSession(true) and getSession(false) methods?

1104


What is the difference between forward () and sendredirect () functions in servlet? Explain

1075


Can we use threads in Servlets?

1192


What is httpservlet class?

1225


What is servlet instance?

1100


Can we override servlet service method?

1149


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

1116


What are the differences between forward() method and sendredirect() methods?

1078