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
JSP Scripting elements There are three types of scripting elements: scriptlet tag. expression tag. declaration tag.
You want to escape those HTML special characters like < , > , & and " . If it is dynamic text, this is best to be done with JSTL <c:out> tag. Of if you want to set a HTML attribute, the JSTL fn:escapeXml() function is nicer. Simple solution but very powerful.
The page directive is used to provide instructions to the container that pertain to the current JSP page. You may code the page directives anywhere in your JSP page. By convention, page directives are coded at the top of the JSP page. Following is the basic syntax of page directive − <%@ page attribute = "value" %>
<%@tag pageEncoding="UTF-8"%>
placed in your tag file will help.
Tag directive attributes resemble ones of its page
counterpart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With