I tried to create a web application.
I wanted to use a build.xml in which there was a target that copied my war in the webapps directory of Tomcat.
The project structure was
webapplication <br>
web/jsp
web/web-inf
web-inf/src/servlets/Myservlet
My web.xml was:
<!-- we give name hello to our servlet -->
<servlet>
<servlet-name>webapplicationServlet</servlet-name>
<servlet-class>servlets/MainServlet</servlet-class>
</servlet>
<!-- when user provides URL /hello then servlet hello is invoked -->
<servlet-mapping>
<servlet-name>webapplicationServlet</servlet-name>
<url-pattern>/firstPage</url-pattern>
</servlet-mapping>
The problem was that the url
http://localhost/webapplication/firstPage was not working while
the url http://localhost/webapplication/page1.jsp was working
The problem was solved after I removed folder web and inside the webapps of the Tomcat the first folder was WEB-INF
.Does anybody has any idea why this was happening?
It is allowed to place web-inf inside another folder right?
Moreover the source coude of the servlet could be anywhere as long as it is copied afterward in web-inf/classes?
Thanking you in advance.