Servlet <url-pattern>: Trouble Mapping to a Directory that's Below My Application Directory
سؤال
I want to have a dedicated directory for jsp and servlet development, but I can't map my app's logical name resource correctly. I tested the app without the extra directory as follow:
C:\tomcat1\webapps\beer-v1
The app ran successfully. But if I map the application to(my desired location):
C:\tomcat1\webapps\dev\beer-v1
The application does not run. I get a 404 error, resource not found. The following is my web.xml file.
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
</web-app>
لا يوجد حل صحيح
لا تنتمي إلى StackOverflow