I connect to JSP bootstrap and styles for <ul> . Styles are connected, but when downloading woff, woff2 and ttf icon files, Failed to decode downloaded font and OTS errors take off. Parsing error: invalid version tag. Because of this, the icons are not displayed. Changed the file encoding to UTF-8 did not help. When loading a page from html, everything works correctly.

    2 answers 2

    web.xml should be like this:

     <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Spring MVC Application</display-name> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <session-config> <session-timeout> 30 </session-timeout> </session-config> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpeg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.png</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.mp4</url-pattern> </servlet-mapping> <filter> <filter-name>characterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>characterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> 
    • this is for pictures, icons, etc. .. - EmErIx_007
    • png began to be displayed, but for files with the woff2, svg and other extensions it did not work. I don’t use Spring in my project, so I didn’t add a filter first, but added a mapping by analogy for the extensions I needed, but it didn’t help. Then I still added dependency to <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> , and pasted in your code, but it did not help. I also tried to add a filter-class from tomcat 'a, but it did not find it at all - Gleb Tuchinnscky
    • <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class> - there was such a class for the filter and the dependency <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-catalina</artifactId> - Gleb Tuchinnscky September
    • I found an error with Tomcat: depending on, I specified version 7 and therefore did not find the required class. Fixed dependency, found a class, but still does not work - Gleb Tuchinnscky
    • In the first comment, under the words "Your code" I meant the part about the description of the filter and its mapping, without DispatcherServlet Sping - Gleb Tuchinnscky

    In general, everything was decided as follows: I connected the files font, bootstrap, jquery via cdn. At the same time, for some reason, the glyphicon buttons became already in height, I had to tweak them with styles. Now everything works correctly.