user12384512
user12384512

Reputation: 3401

Charset of JSP tags

Simple question about charset 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 located in WEB-INF/tags. Charset of this file in eclipse is UTF-8. For some reason UTF-8 symbols do not display properly.

This affect only including tags, another jsp-s that was included display fine

Upvotes: 5

Views: 6522

Answers (2)

Thiago Sousa
Thiago Sousa

Reputation: 1

In my case, the problem was the order of declaration of pageEncoding attribute. I figured out that pageEncoding attribute must be the first attribute declared right after @tag directive.

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

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

Upvotes: 0

Oleg Mikheev
Oleg Mikheev

Reputation: 17444

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

Tag directive attributes resemble ones of its page counterpart.

Upvotes: 20

Related Questions