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

First of all u have to set the value by setAttribute()
method such as:
request.setAttribute("variableName",object);

Then u have to forward that request to other servlet by
using that procedure,

ServletContext con=request.getServletContext();
RequestDispatcher rd=con.getRequestDispatcher("/servlet");
rd.forward(request,response);

U can get that information from that servlet by using the
method::
getAttribute("variableName");

Is This Answer Correct ?    50 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can servlet have a constructor ?

998


How the typical servlet code look like ?

1136


What is difference between GenericServlet and HttpServlet?

1063


What are the exceptions thrown by servlets? Why?

1095


What is servlet looping or chaining?

1072


What are the life-cycle methods for a servlet?

941


Explain how does JSP handle run-time exceptions?

1035


What is meant by a web application

966


How can we include static files in the jsp page?

1006


Can you create a deadlock condition on a servlet?

1022


How to get the current httpsession object?

1070


How do we call one servlet from another servlet?

980


What is the difference in between the httpservlet and generic servlet?

1064


Which application server is best for java?

1020


What is the directory structure of web application?

923