监听tomcat服务器启动/关闭很简单(2步): 1. 建立一个类实现ServletContextListener接口,重写其中的方法(contextDestroyed和contextInitialized). package action; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class SystemListener implements Se
监听页面关闭: window.onbeforeunload = function() { //鼠标相对于用户屏幕的水平位置 - 窗口左上角相对于屏幕左上角的水平位置 = 鼠标在当前窗口上的水平位置 var n = window.event.screenX - window.screenLeft; //鼠标在当前窗口内时,n<m,b为false:鼠标在当前窗口外时,n>m,b为true.20这个值是指关闭按钮的宽度 var b = n > document.documentElement.