This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
You can try using this one. This isnt exactly what you want, but something similar. Clicking on a button takes you to another page. Here you have another button. You either click it within a certain time interval, or you get timed out and sent to a different page.
Hope this helps you.
I'll just give you the relevant servlet code. The rest (mapping, jsp etc) should be easy.