1. 在web容器中设置 2. 在工程的web.xml中设置 3. 通过Java代码设置 session.setMaxInactiveInterval(30*60);//以秒为单位 三种方式优先级:1 < 2 <3