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...

How do you pass the data from one servlet to another
servlet?

Answer Posted / kuru

for example if you want to pass your name from one servlet
to another,

in fiest servlet file....

String name = "Tom"
request.setAttribute("name",name);

RequestDispatcher dis = request.getRequestDispatcher
("Servlet2");

request.Forward(request,response);



in second servlet file....

request.getAttribute("name");
//this line will display "Tom"

Is This Answer Correct ?    46 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is string tokenizer?

1075


What is the difference between servlet and filter?

949


Explain the difference between servletconfig and servletcontext in servlet?

1033


What is servlet looping or chaining?

1131


What is the purpose of inter-servlet communication?

1094


Why is httpservlet declared abstract?

1114


What mechanisms are used by a Servlet Container to maintain session information?

1162


What is servlet initializer?

971


What is preinitialization of a servlet?

1027


How forward () method is different from send redirect () method?

966


Why do we have servlet wrapper classes?

1064


In the servlets, we are having a web page that is invoking servlets ,username and password? which is checks in database? Suppose the second page also if we want to verify

1003


Which method of the httpservletrequest object is used?

1086


If servlet receives multiple requests, how many objects will it create?

1380


What is the major difference between servlet and applet?

997