tags:

views:

19

answers:

1

Need to do Image counter in JSP for how many clicks have clicked for advertisement? Front-End : JSP Backend : Mysql

or

Any other procedure methods for counting number of clicks in advertisement using JSP

A: 

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.

BalusC