My earlier point was that you need to think about it in a slightly
different way.
Starting and stopping the server is something that is normally done
rarely and anyway, you can't start something that is not already started
by using it to start itself!
What you should do is to add a boolean flag - a state variable to your
servlet. You can set or clear this flag with your page button.
Use this flag to condition your database access - so when the timer
event fires, it checks the state flag and then accesses the database.
Regards
Alan
paybackorfail wrote:
Hi, thanks for replying, my application will take some data from a website
and insert this data into a database and i schedule the application to do
this every hour using contextlistener and timertask as a java servlet. At
the moment it starts updating the database as soon as i upload the
application to the server, I need a way to shutdown the server so it will
stop updating the database
Alan Chaney wrote:
I think you need to rethink your use cases here...
Exactly WHY do you need to start and stop tomcat from a button on a web
page?
Or do you really need to enable/disable some kind of function?
Generally speaking servers don't expect to be started or stopped by
their clients - well, ok, sometimes you can stop a service by a client
but almost by definition you can't start a service from a client...
Typically tomcat provides a way of processing requests received from
remote web clients and arranges for the requests to be processed by a
web application. Your application may have state which can be controlled
by the request. This shouldn't normally affect tomcat's normal operation.
HTH
Alan Chaney
paybackorfail wrote:
That's a good point, what if it was just an html page?
Mark Thomas-18 wrote:
paybackorfail wrote:
Hi, I have written a web application in netbeans using java and jsp,
and
i am
hosting it on a server using tomcat, i need help on finding a way to
start
and stop the server by the user clicking a button on a jsp page, do i
have
to use the org.apache.catalina.ant.StartTask of the tomcat api? can
anyone
help?
If Tomcat is stopped, how is it going to handle a user clicking on a
button on a JSP page to start it?
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org