In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, the editor will take you to learn about the example analysis of statistics on the number of people online in portlet. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about the sample analysis of the number of people online in portlet.
Portlet's question about counting the number of people online
Question: is the HttpSessionListener interface implemented in jsp, why not in portlet, or is there another interface?
My wps is 5.1. users who have been tested and logged in can record it. The code is as follows.
Private static int activeSessions = 0
/ * *
* @ see javax.servlet.http.HttpSessionListener#sessionCreated (javax.servlet.http.HttpSessionEvent)
, /
Public void sessionCreated (HttpSessionEvent se) {
ActiveSessions++
SaveOnlineNum ()
}
/ * *
* @ see javax.servlet.http.HttpSessionListener#sessionDestroyed (javax.servlet.http.HttpSessionEvent)
, /
Public void sessionDestroyed (HttpSessionEvent se) {
If (activeSessions > 0)
ActiveSessions--
}
/ * *
* get the current number of online users
* @ return current online count
, /
Public static int getActiveSessions () {
Return activeSessions
}
Anonymous seems to be unable to record, hint: NO PORTLET SESSION YET.
I don't know how to customize it. Give me a hint. Thank you.
[@ more@]
Answer:
Haha, you are asking the right place! Maybe I'm the only one who can answer your question. He he!
It's not particularly difficult to implement this function, but it's important that you understand how the entire Portal container works. Because of the lack of space, I won't dwell on how the Portal container works here.
For your question about online headcount, you just need to know how the entire Portal page is assembled and rendered, that is, where the root of the Portal page is. The root of the Portal page exists in the wps EAR application under Portal Server's installedApps directory, which is known if you have customized themes and skins.
Then the statistics of the number of people online, that is, the statistics of the number of people, must be considered and tracked in the wps application of this EAR.
For example, in the configuration file of WEB-INFweb.xml, add the following filter and listener
ClickStreamFilter
ClickStreamFilter
Com.ibm.portal.user.utils.CustomClickStreamFilter
ClickStreamFilter
/ *
.
.
Com.ibm.portal.user.utils.CustomClickStreamListener
Thank you for your reading. The above is the whole content of "sample Analysis of online Statistics in portlet". Friends who learn to learn, hurry up and get started. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.