标签:包名 ref send rop mapping get 扩展名 编写 hello
路径的编写
form表单的action属性
重定向 response.sendRedirect("/项目名/资源路径");
转发 request.getRequestDispatcher("/资源路径").forword(request,response);
欢迎页面 (直接写资源路径不需要加 /)
  <welcome-file-list> 
        <welcome-file>index.html<welcome-file> 
  </welcome-file-list>
Servlet路径
Cookie路径
cookie.setPath("/项目名/资源路径");
ServletContext路径
ServletContext application= config.getServletContext();
application.getRealPath("/WEB-INF/classes/db.properties");
application.getRealPath("/资源路径");
        1. <url-pattern>可以编写多个
2.精确匹配
   
    <url-pattern> /hello </url-pattern>
    <url-pattern>/system /hello </url-pattern>
3.扩展匹配
    <url-pattern>/hello/*</url-pattern>
 4.后缀匹配
   
   <url-pattern>*.action</url-pattern>
   <url-pattern>*.do</url-pattern>
 5.全部匹配
     
     <url-pattern>url/*</url-pattern>
    
- 优先级  精确匹配  >目录匹配 >扩展名匹配 >全部匹配JAVAEE_Servlet_23_路径编写总结和url_pattern的编写方式
标签:包名 ref send rop mapping get 扩展名 编写 hello
原文地址:https://www.cnblogs.com/szqengr/p/14696490.html