Take note that it is your container's decision to reuse a new
servlet instance (jsp is compiled into a servlet), or instantiate a new servlet.
For that reason, your counter can go back to 1 anytime. It is practically unpredictable.
Just to play with it (this is a bad design thing in most cases), make that 'i' as static. That will fix your issue, but as I mentioned above, you most likely wont use static in enterprise applications as it bring a lot of issues like synchronization.