Click to See Complete Forum and Search --> : How I can restart tomcat and refresh Page


rajiv.birari
10-13-2008, 05:24 AM
Hello Friends,

I am working upload xml form in my Java (JSP) application.
In my upload JSP page when I upload xml file then file upload message come with restart button.
When I click on that button (restart) we call one batch files which stop the tomcat and start tomcat. but in between on page throw the error "Connection Interepted" then we mannualy refresh the page it's working properly.

MY problem is - I want refresh page automatically without showing error on page
Please suggest me solution and other option which I can do efficently my upload with restar tomcat functionality.

Regards
RKB

chazzy
10-13-2008, 05:41 AM
you can do this by creating a servlet listener (specifically, a ServletContextListener), and catch the javax.servlet.ServletContextEvent in your contextDestroyed method. Though, it will take quite a bite of client side code.

rajiv.birari
10-13-2008, 05:47 AM
Thanks chazzy
But I am writting code in JSP.
Can u give me sample code for that then I get exact idea.

starheartbeam
10-14-2008, 01:35 PM
Not sure what your JSP page looks like but here are some ideas for you to look at....might help might not.

to auto refresh the page you could use a meta tag in the jsp page to instruct the browser not to store the page in the cache. That is...
<META HTTP-EQUIV = "pragma" CONTENT="no-cache">


also I think you would want to....(if your not already) when you use<FORM>, the you use METHOD=POST not METHOD=GET.

also to refresh by the browser you can use. This one I use a lot.

<head>
<meta http-equiv="refresh" content="1;url=http://www.yoursite.com">
</head>


Well I hope some of this helped.

Good Luck!