springmvc设置接口后缀名

web.xml设置

html结尾的后缀接口类型

  
    dispatcherServlet
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      classpath:config/dispatcherServlet.xml
    
    
      dispatchOptionsRequest
      true
    
    5
  
  
    dispatcherServlet
    *.html
  

http://192.168.2.14:8080/XXXX/user/login.html?username=%E5%BC%A0%E5%9B%BD%E6%A0%8B&password=202cb962ac59075b964b07152d234b70


如果设置取消后缀名 

  
    dispatcherServlet
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      classpath:config/dispatcherServlet.xml
    
    
      dispatchOptionsRequest
      true
    
    5
  
  
    dispatcherServlet
    /
  

则任意结构的后缀名均可以访问


http://192.168.2.14:8080/XXXX/user/login.aa?username=%E5%BC%A0%E5%9B%BD%E6%A0%8B&password=202cb962ac59075b964b07152d234b70

http://192.168.2.14:8080/XXXX/user/login.vti?username=%E5%BC%A0%E5%9B%BD%E6%A0%8B&password=202cb962ac59075b964b07152d234b70
或者是没有后缀名也可以
http://192.168.2.14:8080/XXXX/user/login?username=%E5%BC%A0%E5%9B%BD%E6%A0%8B&password=202cb962ac59075b964b07152d234b70

你可能感兴趣的:(spring)