JSP tag wrapper

A simple question about the encoding of JSP tags.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib tagdir="/WEB-INF/tags" prefix="custom" %> <custom:mytag> </custom:mytag> 

mytag is simple. tag file is located in WEB-INF/tags . The encoding for this file in eclipse is UTF-8. For some reason, UTF-8 characters are not displayed correctly.

This only affects tags, other jsp-s that have been enabled display small

+4
source share
2 answers

<%@tag pageEncoding="UTF-8"%> placed in your tag file will help.

tag attribute attributes resemble copies of your page .

+16
source

In my case, the problem was the declaration order of the pageEncoding attribute. I realized that the pageEncoding attribute should be the first attribute declared immediately after the @tag directive.

Invalid : <%@tag description="some description" pageEncoding="UTF-8"%>

Correct: <%@tag pageEncoding="UTF-8" description="some description"%>

0
source

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


All Articles