Hello,
Thank you for your answers.
I changed <url-pattern>/*</url-pattern> to <url-pattern>*.jsp</url-pattern>
I also un-commented the line:
servletResponse.setContentType("text/html; charset=" + Finals.S_CHARSET);
It looks like the problem is solved.
> André Warnier wrote:
> As another way of avoiding that problem, you may also want to change
in web.xml :
> <url-pattern>/*</url-pattern>
> by something that applies *only*to HTML responses.
Shall I leave <url-pattern>*.jsp</url-pattern> as it is, or can you
suggest another pattern?
Thank you and best regards,
--
Léa
On 16/01/2020 11:24 AM, André Warnier (tomcat/perl) wrote:
Also note :
https://tomcat.apache.org/tomcat-9.0-doc/servletapi/javax/servlet/ServletResponse.html#setCharacterEncoding-java.lang.String-
says :
"...calling this method with the String of UTF-8 is equivalent with
calling setContentType with the String of text/html; charset=UTF-8."
So, in the above, if you have just commented-out the line :
servletResponse.setContentType("text/html; charset=" +
Finals.S_CHARSET);
but you left the following line unchanged
servletResponse.setCharacterEncoding(Finals.S_CHARSET);
then executing this line is equivalent to setting the content type to
"text/html".
And this looks suspiciously like the error you are getting..
As another way of avoiding that problem, you may also want to change
in web.xml :
> <url-pattern>/*</url-pattern>
by something that applies *only*to HTML responses.