3
I tried creating an app Maven archetype webapp in Eclipse JEE Photon:
File > New > Maven Project > Next > maven-archetype-webapp 1.0
It generates the following file structure:
.
|-- src
| `-- main
| `-- java
| |-- resources
| |-- webapp
| | `-- WEB-INF
| | `-- web.xml
| `-- index.jsp
`-- pom.xml
This is the web.xml
(contrary to what is in the title of the question she has a web.xml
, only this one has nothing interesting inside - and the question is, how does it locate /index.jsp
when starting the application?):
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
The pom.xml
also has nothing special (follows below, just added the dependency Servlets 3.0.1):
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>piovezan</groupId>
<artifactId>webportfolio2</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>webportfolio2 Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>webportfolio2</finalName>
</build>
</project>
...and Ta-dá, it works! It finds the page index.jsp
(that only has the phrase "Hello World")!