目前我有一个Web应用程序,我们使用web.xml来配置应用程序.web.xml有welcome-file-list.
<web-app>
...
<welcome-file-list>
<welcome-file>home.html</welcome-file>
</welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)
我们计划使用spring框架并使用java类进行应用程序配置.
class MyApplication extends WebApplicationInitializer {
public void onStartUp(ServletContext context){
...
}
}
Run Code Online (Sandbox Code Playgroud)
如何在此java类中指定welcome-file-list?
如何在没有web.xml或注释的情况下以编程方式实现此映射?任务不是使用任何框架,如弹簧或其他东西.
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>test.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud) 我可以在定义的不活动时间后注销用户。
<session-timeout>240</session-timeout>
Run Code Online (Sandbox Code Playgroud)
但是,是否有某种方法可以在指定时间或更好的情况下注销,例如直到指定时间后 5 分钟不活动。?