0

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

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Hari kanna
  • 2,461
  • 6
  • 29
  • 43

1 Answers1

0

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.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555