出现:
'com.shi.filter.Filter' is not assignable to 'javax.servlet.Servlet,jakarta.servlet.Servlet'
原因:
<servlet> <servlet-name>Filter</servlet-name> <servlet-class>com.shi.filter.Filter</servlet-class> </servlet> <servlet-mapping> <servlet-name>Filter</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping>
解决:
<filter> <filter-name>Filter</filter-name> <filter-class>com.shi.filter.Filter</filter-class> </filter> <filter-mapping> <filter-name>Filter</filter-name> <url-pattern>/servlet/*</url-pattern> </filter-mapping>