java - 如何实现网站访问次数记录
阿神
阿神 2017-04-18 10:54:45
0
5
746

各位大佬好,小弟现在对一个问题比较迷惑,如何统计网站的访问次数,目前使用的技术方案是SSM(spring+springmvc+mybatis),不知道这个功能应该是实现在哪里,请各位赐教。

阿神
阿神

闭关修行中......

reply all(5)
左手右手慢动作

1. If there is a reverse proxy tool such as nginx, you can directly hand it over to nginx for statistics.
2. You can use the servlet interceptor to intercept the required statistical requests, and then classify or summarize statistics as needed.
3. You can use servlet filters to filter requests that require statistics, same as above.
4.Spring aop is also a good choice.
5. If it is a js script, requests that do not need to access the page cannot be counted.
6. Statistics of container access logs.

If there is load balancing, 23456 needs to be summarized at the end, which is more troublesome.

Peter_Zhu

Website access records? You can use Baidu’s statistical tool and just add that Js code to the public part of the page

刘奇

Write an interceptor in spring. Record each visit.
Or use third-party tools such as Baidu to embed the script directly

阿神

I will talk about a relatively primitive method, write an HttpSessionListener, maintain a static access count variable, +1 every time a session is created, of course you must pay attention to multi-threading issues

伊谢尔伦

Just use application

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template