Question

I created a web project using maven using:

mvn archetype:generate -DgroupId=com.test -DartifactId=ioehr -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

then imported project in eclipse and modified the web.xml file to add welcome file entry as:

<web-app>
    <display-name>test</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

by default this was the project structure

--src
-----main
---------webapp
---------------WEB-INF
----------------------web.xml
---------------index.jsp
--WebContent
-----WEB-INF
------------lib
------------web.xml
-----pom.xml

And then try to run project on server. and it gave me exception as The requested resource (/test/) is not available.

And when I moved index.jsp to WebContent folder it shows me the welcome page.

My question is , Why I manually needed to move index.jsp in WebContent folder. Why it didn't work in webapp folder

Was it helpful?

Solution

Eclipse serves files out of the WebContent folder by default. When you moved index.jsp to WebContent Eclipse found it and served it back.

You can change the location of WebContent to point at your project content as described here: How do I change in an eclipse web project the WebContent folder to something different?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top