Hello everyone, I have a servlet in which an array is created and populated. I need to allow another servlet to access the values of the array (In the first servlet, the array is created & populated and then part of its values are displayed, while the second servlet should display the whole thing). How should I do this? I tried using a storage class but this doesn't work.
Hello! U can put the array in the context or session object according to ur required condition and the scope u want to give to the array. In second servlet get the array cast it and use, simply like others attributes u use
I think u cant put the array into session and pick it up in the next screen. One more way is to declare it as public so that it will be available in consecutive screens.
Have a wonderful day and wish u success<p>S Chandra Mohan<br />email@example.com
Joined: May 07, 2002
That's brilliant, it worked! Thanks a million.
Joined: Apr 21, 2002
Originally posted by S Chandra Mohan: I think u cant put the array into session and pick it up in the next screen. One more way is to declare it as public so that it will be available in consecutive screens.
can u please tell me why u cant put the array into the session and pick it bact. i do it and it is working.
You don't say if the array data is unique to a particular user or if it changes. If the data can be calculated once and does not change per user, then you can use the servlet context. If it changes per user you should use session - thats what session if designed for. Bill
subject: Getting array data from one servlet to another