标签: programmatic-config

如何在WebApplicationInitializer.onStartup()中指定welcome-file-list

目前我有一个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?

spring web.xml welcome-file programmatic-config

15
推荐指数
3
解决办法
2万
查看次数

以编程方式映射servlet,而不是使用web.xml或注释

如何在没有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)

mapping servlets programmatic-config

4
推荐指数
2
解决办法
2886
查看次数

以编程方式更改会话超时

我可以在定义的不活动时间后注销用户。

<session-timeout>240</session-timeout> 
Run Code Online (Sandbox Code Playgroud)

但是,是否有某种方法可以在指定时间或更好的情况下注销,例如直到指定时间后 5 分钟不活动。?

jsf web.xml servlets session-timeout programmatic-config

2
推荐指数
1
解决办法
3254
查看次数