JSTL fmt:requestEncoding Formatting Tag

The JSTL <fmt:requestEncoding> Formatting Tag is used to specify the encoding type.

Syntax: <fmt: requestEncoding value=”encodingType” />

fmt:requestEncoding tag attributes:

Attribute Description Required
key It specify the name of character encoding you want to apply when decoding request parameters. Yes

Example:

test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 
<html>
	<head>
	 <title>fmt:requestEncoding JSTL formatting tag example</title>
	</head>
	<body>
	     <fmt:requestEncoding value="UTF-8" />
	     <fmt:bundle basename="com.javawithease.properties.message">
		   <fmt:message key="message.first"/><br/>
		   <fmt:message key="message.second"/><br/>
		   <fmt:message key="message.third"/>
	     </fmt:bundle>
	</body>
</html>

message_en_US.properties

message.first = This is first message using en_US locale.
message.second = This is second message en_US locale.
message.third =This is third message en_US locale.

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>test.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 51
 
Download this example.
 
Next Topic: JSTL Functions with example.
Previous Topic: JSTL fmt:setTimeZone Formatting Tag with example.

Related Topics:

JSTL fmt:formatNumber Formatting Tag with example.
JSTL fmt:parseNumber Formatting Tag with example.
JSTL fmt:formatDate Formatting Tag with example.
JSTL fmt:parseDate Formatting Tag with example.
JSTL fmt:bundle Formatting Tag with example.
JSTL fmt:setBundle Formatting Tag with example.
JSTL fmt:setLocale Formatting Tag with example.
JSTL fmt:timeZone Formatting Tag with example.
JSTL fmt:setTimeZone Formatting Tag with example.
JSTL fmt:requestEncoding Formatting Tag with example.