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.
The moose likes Servlets and the fly likes running servlet after the browser is closed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "running servlet after the browser is closed" Watch "running servlet after the browser is closed" New topic
Author

running servlet after the browser is closed

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Hi,

I am having a jsp page which selects a network from a combo box and submit to a servlet which get the network from the jsp page and dials the contact numbers from the network.I am refreshing the servlet page.

Now what i need is if i close the servlet page the refresh stops and the whole process stops.How can i proceed the servlet's process even after i close the browser?please assist me to do this.

Thanks
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Run it in a separate thread.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
preethi Ayyappan wrote:Hi,

I am refreshing the servlet page.



what do you mean by refreshing the servlet page ?? and how are you closing the servlet page ?

Have you made a servlet that will produce a HTML View ??


If you want something you never had do something which you had never done
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
yes,my servlet will produce a HTML View .And i used
response.setHeader("Refresh","1")
to refresh that page.

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
This should not happen , something is wrong.

Post your servlet code
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518


If i select a network(example:vodafone) in jsp page and click start button,this servlet will work which gets the contact numbers from the selected network and dials the numbers.so i have to refresh this continuously to check the database
until I give stop in the jsp page.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Hi preethi ,

1.How did you confirm that the servlet is not refreshing ??

2. Try to set the Cache Headers on to the servlet .

If all above doesn't work then make changes from your calling jsp itself.

Inside JSP call a function on body onload and



Hope this helps



RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
remove refresh headers in servlet
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Thanks.I will try this and reply you
preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518
Hi,I have tried your code inside my jsp code.But it remains in the same page.nothing happened there



I need to give the servletclass name in form action also?

Thanks
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
servlet class name??

Give the url pattern name for which the particular servlet will be get called.
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
why are you creating connections for every time you select option .Make a utility class and call that method or in your case simply override the init method of the jsp and obtain a common connection from there .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: running servlet after the browser is closed