I started learning jsp and did some simple web application examples. I am coding a simple shop and dynamic web-app name is Book0. The index.html redirects
response.sendRedirect("/Book0/eshop");
while the item list is null (initial access).
Now I deployed the application on tomcat via .war export on eclipse. I had the servlet coded on servlet.Servlet0;
the web.xml for the app, I added on top welcome file list on generic eclipse web.xml:
<servlet>
<servlet-name>EshopServlet0</servlet-name>
<servlet-class>servlet.Servlet0</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>EshopServlet0</servlet-name>
<url-pattern>/eshop</url-pattern>
</servlet-mapping>
My other application has been working so far. But this one hits 404 when redirects to the servlet.. Any ideas what has gone wrong. Thx
In Servlet0, you have @WebServlet("Servlet0") but you also have in your web.xml /eshop. You only need one and they should agree with each other. You could remove annotation or change to @WebServlet("eshop") or @WebServlet("/eshop")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.