File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes interrupting a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "interrupting a servlet" Watch "interrupting a servlet" New topic

interrupting a servlet

igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
Hello, I've written a servlet which runs on my tomcat server. Using the get method on an html page I am able to load this servlet. The problem I have is this:

the doGet method of the servlet usually takes quite a while to complete. nothing wrong with this, i made it so as the program is fairly complex. so the issue for me now is finding a way to interrupt the execution of the doget() method from my html file. I want to do it using a html button or input tag (submit button or anything else). how do i go about it. thanks.
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
I feel you can't do it from the html page once a request is submitted we don't have any control on that REQUEST from the html page. It is running as thread inside the servlet. If you try to control from the html page, the request will be all new and it will be new thread again.

Actually what is the real output you want? Why do you need to interrupt from the html page?

You can control the thread in side doGet method anyway which should be coded in the doGet method itself.


Sarath Mohan
I agree. Here's the link:
subject: interrupting a servlet
It's not a secret anymore!