Which has higher priority, welcome-file-list or url-pattern?

url: I requested in the browser

http://localhost:8080

A servlet and < welcome-file-list > are configured in web.xml, respectively, with the following code

<welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<servlet>
    <servlet-name>userservlet</servlet-name>
    <servlet-class>com.tuobida.servlet.UserServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>userservlet</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>
< H2 > question < / H2 >

I have defined the servlet, of * .html path matching but also defined the welcome interface (the index.html file does not exist). Why not execute servlet, but report 404

Mar.20,2021

dude, can you try and ask questions again?!


your request does not have .html , so it will not be requested that servlet, servlet matches url, so even if container tries to find welcome-file, it will no longer be processed by servlet. Because welcome-file is not implemented through browser redirects (different from response.sendRedirect (xxx)).

  • Link to servlet and execute doGet ()?

    http: localhost:8080 guestbook servlet getMessages can query the database servlet getMessages is the URL of GetMessagesServlet. Query database function defined in doGet () in GetMessagesServlet. Why do you execute doGet () when you connect to this...

    Mar.07,2021
  • Can servlet respond to non-http requests?

    see a lot of descriptions that servlet can handle almost all types of requests, but mostly only http. So you want to know what other requests servlet can handle? It is best to enumerate related classes. ...

    Mar.07,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37639-2c093.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37639-2c093.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?