I wantr to know, How many number of users logged in to
website? can any one answer
Answers were Sorted based on User's Feedback
Answer / anket dhulekar
Use listeners. Since you want to to know how many users have
logged in, so the login info would be stored in a session.
You can create a filter by extending HttpSessionListener,
and update a static variable when the session is created.
The value of this variable will store the number of users
currently logged on.
Is This Answer Correct ? | 18 Yes | 1 No |
Answer / sunil
HttpSessionListener is Listener whenever session is created.
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
public class SessionCounter implements HttpSessionListener {
private static int activeSessions = 0;
public void sessionCreated(HttpSessionEvent se) {
activeSessions++;
}
public void sessionDestroyed(HttpSessionEvent se) {
if(activeSessions > 0)
activeSessions--;
}
public static int getActiveSessions() {
return activeSessions;
}
}
Is This Answer Correct ? | 15 Yes | 0 No |
Answer / namy
Create a static variable and increment it every time the
page/sit gets loaded.
Is This Answer Correct ? | 7 Yes | 4 No |
Answer / ritesh parkhi
Number of users loged on website is depends on Pool Size of
there connection string. By Default MaxPoolSize=100 and
MinPolSize=0.
if Max pool size in 100 so only 100 user can loged in.If 101
user will try to simultaneously you will get TimeOut error
because your connectionstring wait to free one of connection
onject out of 100.
Is This Answer Correct ? | 7 Yes | 6 No |
Answer / pradeep
1. If the website is static pages no data base interaction
then using static variable we can find out how many users
loged into the system.
2.If the webpage is data base centric and for accessing
any page we are retriving data then we can find the max. no
of connections .
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / raju
we need to write a servlet class, that is login servlet class. Whenever user going to login to the application ,server has to create login servelt object. so every time service method got executed for every user login. so write a private static int count variable as part of login servlet class and increment the counter value in service() method and store the counter value into application scope.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / raju ranjan sinha
The Number of threads can run simmultaneously by the server
is equal to the number of persons can log into a web site.
Is This Answer Correct ? | 5 Yes | 12 No |
In a multitiered application which tier is the browser in?
Where can I find seam examples and documentation?
Why does the tag url-encode javascript and mailto links?
What state does a thread enter when it terminates its processing?
1) which method of the RequestDispatcher cannot be called once the output is sent to the client? a. forward b. include c. both a&b 2) which interface should an object implement to get notified of changes to the list of active sessions in a web application? a. HttpSessionListener b. HttpSessionActivationListener c. HttpSessionAttributeLIstener 3) A user can select multiple locations from a list box on an HTML form, which of the following methods can be used to retrieve all the selected location? a. getParameter() b. getParameterValues() c. getParamValues() 4) which of the following methods should be used to send character text to the client? a. ServletResponse.getWriter() b. ServletResponse.getOutputStream() c. ServletResponse.getOut() 5) which implicit object is always available in a JSP page? a. exception b. session c. out 6) which inclusion mechanism doesn't include the source of the page, rather the output of the page. a. include directive b. jsp:include action c. Bothe a& b 7) which attribute of the page controls whether a page participates in session or not? a. session-allowed b. session c. isSession
What is serialization and de-serialization ?
What is RMI Registry?
6 Answers Siemens, United Software Solutions,
Difference between hashmap and hashtable?
what are the advantages of JTA over JTS?
How would you reatach detached objects to a session when the same object has already been loaded into the session?
What value does readline() return when it has reached the end of a file?
whether the connectionpooling used in struts?