Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 959
user12384512 Avatar asked Feb 11 '12 18:02

user12384512


People also ask

What are the different types of JSP tags?

JSP Scripting elements There are three types of scripting elements: scriptlet tag. expression tag. declaration tag.

How does JSP handle special characters?

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.

What is <%@ in JSP?

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" %>


1 Answers

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

Tag directive attributes resemble ones of its page counterpart.

like image 174
Oleg Mikheev Avatar answered Jan 03 '23 10:01

Oleg Mikheev