how to control threads in a jsp page using javascript button? when i click on a button, i should be able to pause a thread. i have tried writing code in a function using <% ... %> tags, but they are executed automatically on page load. and when i click on the button, nothing happens.
First of all these tags <% ... %> are not loaded on page load. JSP code is compiled on the server into Servlet code before it goes to the browser. If you do a View Source on the page after it gets to your browser, you will see the tags have been replaced. The view source is what the browser sees. Browsers don't see JSP code. In order to stop a thread you would have to keep track of it's instance on the server. From your html you would have to hit the server again, locate the thread and stop it. I'm not even sure if this is possible. Java and Javascript are vastly different languages. You need to go to a Java or JSP forum. This is off topic here.