| 我是 
 spring框架的新手今天我遇到了web.xml文件中的调度程序servlet配置,我想出了一个关于url模式的问题,比如这个语法/.那么,如果我在tomcat服务器中部署web应用程序,实际上“/”符号适用的是:host:port /或host:port / myWeb /
 解决方法
 模式/将使您的servlet成为应用程序的默认servlet,这意味着它将获取没有其他完全匹配的每个模式. 
  
  URL模式映射:  
   
   A string beginning with a / character and ending with a /*suffix is used for path mapping.A string beginning with a *.prefix is used as an extension mapping.A string containing only the /character indicates the default servlet of the application. In this case the servlet path is the request URI minus the context path and the path info isnull.All other strings are used for exact matches only. 路径映射规则:  
   
   The container will try to find an exact match of the path of the request to the path of the servlet. A successful match selects the servlet.The container will recursively try to match the longest path-prefix. This is done by stepping down the path tree a directory at a time,using the /character as a path separator. The longest match determines the servlet selected.If the last segment in the URL path contains an extension (e.g. .jsp),the servlet container will try to match a servlet that handles requests for the extension. An extension is defined as the part of the last segment after the last.character.If neither of the previous three rules result in a servlet match,the container will attempt to serve content appropriate for the resource requested. If a default servlet is defined for the application,it will be used.(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |