This is a little off topic, but just in response to your original scenario "suppose if i want to store Login detail that is USERID and PASSWORD"...
I just wanted to say that, at least in my opinion, saving passwords to a session isn't a good idea because having the password in the session would serve no purpose after the user has successfully logged in. Just something to consider, perhaps there are scenarios were storing passwords might be useful?
You can have a bean that contains information related to session that you might want to use later alone with the username. Once login is successful you can create a instance of this bean and store it in session.
As Rahul said, its better and efficient to store an Object (container) which is typically a bean that has the required information as its properties. In this case, the number of objects to be dealt with is #1 and not many.
I think you must have simply thought of asking how to store the login related information into a session. While asking the same, you would have mentioned the USERID and PASSWORD! Aint I? If not, then i am also in the queue waiting for the reasons to know the demand of storing the password in session.
Thanks for your replies, Actually i just gave a scenario i,e storing user id and password in session ...im not going to store the password in session by any means, i'm storing the userid which will be helpful in identifying the particular user among many.