access the servlet classname or servlet name
http://127.0.0.1:8080/testserver
testserver should it be the servlet name of classname of the servlet ?
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>helloTest</display-name>
<servlet>
<description>
</description>
<display-name>foo</display-name>
<servlet-name>foo</servlet-name>
<servlet-class>
foo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>foo</servlet-name>
<url-pattern>/foo9</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
ok so i say
http://127.0.0.1:8080/helloTest/foo9
it works, but when i \say
http://127.0.0.1:8080/helloTest/foo
it does开发者_高级运维nt work why is that ?
testserver
should match the <url-pattern>
in the <servlet-mapping>
.
(Or the argument to the @WebServlet
annotation)
精彩评论