我正在使用 web 模块 3.0 创建 servlet,并且我看到没有与之一起创建的 web.xml,比如说,如果我的项目中有多个 jsp 页面,我如何指定欢迎文件,我们是否有任何注释提及欢迎文件?
最佳答案
你可以结合使用@WebServlet注解和web.xml文件。
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
...
</welcome-file-list>
</web-app>
只需手动创建即可。
关于java - 如何在 servlet web 模块 3.0 中指定欢迎文件列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33390722/