我有现有的web-app,我想将其转换为web.xml-less servlet 3.0.我已经设法使它工作,但是web.xml中有2个标签,我仍然不知道web.xml-less环境中的等效代码.
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/pageNotFound</location>
</error-page>
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏
我正在使用Spring MVC开发一个Web应用程序,它基于纯Java,没有web.xml配置.我编写了下面的类来加载bean并设置url模式.如何设置welcome-file?
public class MyAppWebAppIntializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext appCtx = new AnnotationConfigWebApplicationContext();
appCtx.register(ApplicationContextConfig.class);
Dynamic dispatcher = servletContext.addServlet(
"SpringDispatcher", new DispatcherServlet(appCtx));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/");
}
}
Run Code Online (Sandbox Code Playgroud)