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.
If you want this seamless so that the brower doesnt refresh the page when you click the button you will have to create an AJAX call.
Using jQuery for instance this makes it all really easy. See Ajax – jQuery API for more information.
Once you make the ajax call you need to have a servlet or something receiving this call and then just take it from there to pause the running state of the thread in question.
i have not done programming using AJAX yet.
it seems to be able to solve the problem.
will give it a try.
Originally Posted by Json
thanks for the advice.
but as i went through the Ajax books, i saw that only text-data can be passed between a server and client using jsp.
how can i locate the thread in the server and then control it ?
please suggest some coding example..
Well I guess you start up the server and start each thread you want to control, you then save these threads in lets say a map so that you have a reference to them.
Whenever you then make an AJAX request to the server like so for instance.
The NAME_OR_ID will then be used on your server side to look up the thread from the map and set whatever status you need to paused or whatever :)
Hope that makes any sense.