I'm trying to create a filter, but it doesn't work. In the web file of the maven project structure, the filter-servlet value is highlighted in red as an error.

<welcome-file-list> <welcome-file>newsPage</welcome-file> </welcome-file-list> <filter> <filter-name>Filter Push</filter-name> <filter-class>ru.spb.FilterPush</filter-class> </filter> <filter-mapping> <filter-name>Filter Push</filter-name> <servlet-name>PushNewsServlet</servlet-name> </filter-mapping> 

It works only when I use / newsPage instead. But how then applied?

Zhava-code filter

 public class FilterPush implements Filter { private String encoding; public void init(FilterConfig config) throws ServletException { // читаем из конфигурации encoding = config.getInitParameter("requestEncoding"); // если не установлена - устанавливаем UTF8 if (encoding == null) encoding = "UTF8"; } public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain next) throws IOException, ServletException { request.setCharacterEncoding(encoding); next.doFilter(request, response); } public void destroy() { } public boolean isLoggable(LogRecord record) { return false; } } 

    0