相关疑难解决方法(0)

servlet映射url模式中/和/*之间的区别

熟悉的代码:

<servlet-mapping>
    <servlet-name>main</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>main</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

我的理解是/*地图http://host:port/context/*.

怎么样/?它肯定不会映射到http://host:port/contextroot.事实上,它会接受http://host:port/context/hello,但拒绝http://host:port/context/hello.jsp.

任何人都可以解释如何http://host:port/context/hello映射?

web.xml servlets url-pattern

171
推荐指数
4
解决办法
17万
查看次数

标签 统计

servlets ×1

url-pattern ×1

web.xml ×1