This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.