How to set JSP page encoding using servlet 3.0 (or Spring) annotation?

I recently converted my XML-based configuration to pure annotation (using a mixture of the javax.servlet.annotation and Springframework classes). One thing I did not understand how to set it up:

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
</jsp-config>

Any ideas? Thank!

+4
source share
1 answer

I ran into the same problem.

<%@ page contentType="text/html; charset=utf-8"%>

in every JSP fixes the problem.

Still looking for a better way to handle this.

0
source

Source: https://habr.com/ru/post/1530911/


All Articles