首页 > 解决方案 > How to calculate how many times a HTML, CSS and JS file is loaded using JSP?

问题描述

I am working on a Web App project where I am using JSP. I am trying to count no.of Hits(no.of times each and every file is loaded) happened in my Web App. For this, I have to calculate how many numbers of times each and every HTML, CSS, js, JSP, servlets and almost every file that is used to provide a particular page.

If anyone have a solution or know any resources on how to achieve this kind of problem please provide me links or answers.

I am using Apache tomcat server and MySQL.

Thank you in advance.

标签: javascriptjavajspservletsjsp-tags

解决方案


一种计算方法是创建一个过滤器来计算每个请求并维护请求计数的映射。每次请求通过过滤器时,如果请求已经在地图中,您只需检查并增加计数。对于特定的jsp,您可以将一些特定于该jsp 的尾部标识符添加到jsp 内的所有内容中,以识别该jsp 的请求。

您可以进一步对 css、jsp 和所有的请求进行分类。你明白了。


推荐阅读