【发布时间】:2015-03-21 04:32:21
【问题描述】:
在没有web.xml的情况下,欢迎文件配置在哪里?
背景:
10.10 欢迎文件
Web 应用程序开发人员可以在 Web 应用程序中定义称为欢迎文件的部分 URI 的有序列表 部署描述符。
Java Servlet 规范版本 3.0 Rev a 2010 年 12 月
我正在使用 Netbeans 8,但没有意识到 web.xml 的职责现在主要由注释完成。但是,我似乎找不到与欢迎文件相关的注释。目前,index.html 加载,我想将其重新配置为 foo.jsp。在不创建web.xml 文件的情况下可以做到这一点吗?
另见:
https://stackoverflow.com/a/19317470/262852
更新:
我补充说:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" 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">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>foo.jsp</welcome-file>
</welcome-file-list>
</web-app>
作为web.xml,它工作正常——但希望在没有xml 的情况下完成相同的结果。
【问题讨论】:
标签: jsp jakarta-ee servlets netbeans web.xml