3

In the absence of web.xml, where is the welcome file configuration?

background:

10.10 Welcome Files

Web Application developers can define an ordered list of partial URIs called welcome files in the Web application deployment descriptor.

Java Servlet Specification Version 3.0 Rev a December 2010

I'm using Netbeans 8 and didn't realize that web.xml duties are now largely done with annotations. However, I can't seem to find an annotation relating to welcome files. Currently, index.html loads, I'd like to reconfigure that to foo.jsp. Can this be done without creating a web.xml file?

see also:

https://stackoverflow.com/a/19317470/262852

update:

I added:

<?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>

as web.xml and it works fine -- but would like to accomplish the same result without xml.

Community
  • 1
  • 1
Thufir
  • 8,216
  • 28
  • 125
  • 273

1 Answers1

5

In Servlet 3.0, several new annotations are defined. These annotations are resided in the package javax.servlet.annotation.

As you can see , There is no special annotation to define the welcome-file list ,also please refer to this answer here .

but please check the following answer here as it describes a workaround to get your welcome file reconfigure that to foo.jsp .

if you are on tomcat server, also check this answer here.

Hope that helps

Community
  • 1
  • 1