Need to do Image counter in JSP for how many clicks have clicked for advertisement? Front-End : JSP Backen开发者_高级运维d : Mysql
or
Any other procedure methods for counting number of clicks in advertisement using JSP
Create a Filter
and map it on an url-pattern
covering the image's URL. Then basically do the following in doFilter()
method:
clickDAO.increment(request.getRequestURI());
chain.doFilter(request, response);
And in the ClickDAO#increment()
just basically do an UPDATE click SET count = count + 1 WHERE image = ?
.
At least, the JSP is the wrong place to implement this logic.
精彩评论