I'm learning and making a website with a tomcat server with servlet/JSP.
I can reach my home page with this URL :
ip:8080/myapp/Home
it's actually a servlet which take the request and respond with a JSP.
So until here no problem.
But i wanted reach the home page with this URL (shorter) :
ip:8080/myapp/
So after editing the web.xml adding a new mapping section like that :
<servlet-mapping>
<servlet-name>Home</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
It was working but i had a strange bug : impossible to get my image, .css, .js file... Actually when i checked the file (css/img...), for example logo.png the server sent me the Home Page (JSP) in respond. I don't understand why.
So, anyone have an idea how to fix this ? BTW, when i delete the servlet-mapping it's working so, it i'm sure it come from this part ~
Is it not possible to add two servlet-mapping on the same servlets or something like that ? I need to...
the web.xml :
<servlet>
<servlet-name>Home</servlet-name>
<servlet-class>pages.Home</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Home</servlet-name>
<url-pattern>/Home</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Home</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>