以下代码在访问者访问jsp页面时不显示访问次数。此处计数器增加一个固定数字,即增加一(+1)。我如何增加号码。每次访问刷新时,随机访问次数分别是10,15,18等。
JSP ----------------------
Integer hitsCount = (Integer)application.getAttribute("hitCounter");
if( hitsCount ==null || hitsCount == 0 )
{
/* First visit */
hitsCount = 1;
}
else
{
/* return visit */
hitsCount += 1; // Here I want that hitsCount to be
increased by random number lets say by +=10, +=15, +=18 etc each time the
page gets refreshed
}
application.setAttribute("hitCounter", hitsCount);
out.println(hitsCount);// shows total no of visits