I'm having a strange problem, i have a servlet that is mapped to /home and /home/next with the web annotation as follows:
@WebServlet(urlPatterns= {"/home", "/home/next"})
public class IndexServlet extends HttpServlet {
and it's doGet method send an index.jsp that has the following:
<body>
<p>Hello world!</p>
<img src="resources/logo.png" alt="logo">
</body>
and the files hierarchy is as follows:
- src/main/
- java/
- IndexServlet.java
- webapp/
- WEB-INF/
- index.jsp
- resources/
- logo.png
- WEB-INF/
- java/
And here is the problem, when i access
localhost:8080/_08/home (_08 is the projects name)
Everything is as to be expected, it works fine. However, if i were to access
localhost:8080/_08/home/next
I get the expected jsp but the image won't load, i get the broken image icon.
I dont understand why it happens, i tried adding a url pattern like this:
@WebServlet(urlPatterns= {"/home", "/home/next", "/foo", "/foo/bar"})
public class IndexServlet extends HttpServlet {
and i get the same result, the /foo work, but /foo/bar doesn't, it also won't load the image. I'm using Tomcat v10.0 and Eclipse JEE IDE.
Thank you guys in advance.