tags:

views:

48

answers:

1

I created one web application so i want to store my past logged user name list for comparing new users which are going to login. so how i do that by using ServletContext ? or is there any other way?

A: 

In JSF, application scoped managed beans are stored in the servletcontext. So, you could basically just create and declare an application scoped managed bean and put the list in there.

However, there are probably better ways for the particular functional requirement which is yet unclear in the question. At least, implementing a HttpSessionListener or HttpSessionBindingListener is probably a better idea since logins are usually coupled to the HttpSession.

Here are several examples:

BalusC
@balusC thanks For giving me this answer!!!
vinod
@vinod: on this site, the right way to say thanks means upvote or accept the answer.
JoseK
@balusC i tried using HttpSessionBindingListener but i am not able to do, can u send me the some example which can be helpful for solving this problem?
vinod
or anyone can me give the different approach?
vinod
The examples are available in the links in the answer. In the future, you need to elaborate the "i am not able to do" in more detail. What are the functional requirements? What code do you have as far? What exactly happens? What exactly happens not? As far now it much sounds like that you couldn't even write a single line of code or couldn't get it to compile. My direct answer would then be: learn Java first.
BalusC
@balusC sry for asking simple question. actually i am new in the web development word so i am trying to learn as much as possible with the help of internet and from the guys like u. and i am trying to improve my knowledge also in java. and i accept your direction sir Thanks!!!
vinod
I have done it thanks for all your supports!!!
vinod