Problems with servlet default index.jsp and /

I set servlet mapping

<servlet>
      <servlet-name>Site</servlet-name>
      <servlet-class>com.demo.controller.App</servlet-class>
  </servlet>

    <servlet-mapping>
        <servlet-name>Site</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

there is also an index.jsp in the webapp directory

< hr >

so that when I visit http://localhost:8080/, I will still go index.jsp
without triggering the doGet method of my default App controller
unless I casually write a directory such as http://localhost:8080/a/ will trigger

.

Why is this?

Mar.08,2022

I already know what's going on.
because I have index.jsp, in the web root directory and then I access the default path, tomcat will map your path to xxx/index.jsp, and then exactly match the last controller called JspServlet to deal with it according to the Servlet matching rule. If I change index.jsp to index.html, I will handle it with my servlet

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-1e8c429-46e7a.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-1e8c429-46e7a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?