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 to pass session values from one servlet container to another servlet container? or how can we get session values of one container in another container?

Answers were Sorted based on User's Feedback



How to pass session values from one servlet container to another servlet container? or how can we ge..

Answer / mohit rana

It's simple just use session (session object).
HttpSession session = request.getSession();
session.setAttribute(String obj);
and get the above value on other container
session.getAttribute(String obj);

Is This Answer Correct ?    16 Yes 5 No

How to pass session values from one servlet container to another servlet container? or how can we ge..

Answer / satishkumar vishwakarma

We can Pass Session value from servlet container to another
with the help of Session Object
E.g. I have two Servlet named ServletA and ServletB if i
want to pass value from ServletA to ServletB using Session
Object.
i.e. HttpSession session = request.getSession();
//Now i want to pass my name from ServletA to ServletB
String s = "Satishkumar V";
session.setAttribute("myname",s);
//Now i want to display this name in ServletB Then we will
write the following code in ServletB

HttpSession session = request.getSession();
String s = (String)session.getAttribute("myname");

//Now we can display the value of s in anywhere in Servlet B
out.println("<h1>"+s+"</h1>");

Is This Answer Correct ?    10 Yes 1 No

How to pass session values from one servlet container to another servlet container? or how can we ge..

Answer / karnakar thallapalli

Generally we use session binding listeners
your class must implements HttpssionBindingListenre(not suer class name) and and implement its methods..............

Is This Answer Correct ?    3 Yes 1 No

How to pass session values from one servlet container to another servlet container? or how can we ge..

Answer / atul

sry but the qu is How to pass
session values from one servlet
container to another servlet
container not from one servlet to
another servlet and every web server
or application server contain only
one servlet container

Is This Answer Correct ?    1 Yes 0 No

How to pass session values from one servlet container to another servlet container? or how can we ge..

Answer / animesh kumar

Session Values Can Be passed from one servlet container to
another in FOUR ways :

1. URL rewriting
2. Hidden Form Fields
3. Cookies
4. Using a session Object

Is This Answer Correct ?    2 Yes 3 No

How to pass session values from one servlet container to another servlet container? or how can we ge..

Answer / vemula bojjanna

by using setAttribute()and getAttribute()
for example list is one variable in one servlet like
List l=new list();
l.add("bujji");
l.add("vemula");
u set this value from this servlet by using
req.setAtribute("list",l);
by using getAtribute() u can use the list value of first
servlet into second servlet like
req.getAtribut(list);

Is This Answer Correct ?    3 Yes 14 No

Post New Answer

More Servlets Interview Questions

What is Server-Side Includes?

1 Answers   IBM, SAS,


Explain get and post.

0 Answers  


Hi frnds iam new to Java Kindy any one can provide or me Servlets Example code and can explain to me flow of servlets and as Jsp and Struts and provide to me some sample example on these 3 topic flow,code example,and tutorials,and related websites which i can refer....thanks in advance..........

3 Answers  


What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?

0 Answers  


What are the drawbacks of cgi?

0 Answers  


How to invoke a Servlet?

2 Answers   Mastek,


Difference Between Web Server and Application server ??

4 Answers   PWC,


what is meant by servlet to servlet communication?

1 Answers   KPIT,


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

0 Answers  


What are some advantages of storing session state in cookies?

0 Answers  


What is the purpose of inter-servlet communication?

0 Answers  


What is called servlet container?

0 Answers  


Categories