I am confused with the ini() and destroy() for servlet. It is said that they are for servlet containter, so normally we don't need to btoher to use it.
If I have applet in a html file on webserver, this applet calls servlet on Tomcat by URL connection, then the servlet do a lot of data search(need long time) then return some data to the applet. For this case, the connection btw the applet and servlet will stay there until users close their web browser? is it right?
Actually no, there's a separate HTTP timeout -- the URL connection will eventually time out after a few minutes if the servlet takes too long to process. The length of that timeout is something you can adjust in your application server configuration.
And "destroy()" is only called when the servlet container shuts down.