- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to maps key to the localized message and performs the parametric replacement in a JSP?
The <fmt: message> tag maps key to the localized message and performs the parametric replacement.
Attribute
The <fmt: message> tag has the following attributes −
Attribute | Description | Required | Default |
---|---|---|---|
key | Message key to retrieve | No | Body |
bundle | Resource bundle to use | No | Default bundle |
var | Name of the variable to store the localized message | No | Print to page |
scope | The scope of the variable to store the localized message | No | Page |
Example
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %> <%@ taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix = "fmt" %> <html> <head> <title>JSTL fmt:message Tag</title> </head> <body> <fmt:setLocale value = "en"/> <fmt:setBundle basename = "com.tutorialspoint.Example" var = "lang"/> <fmt:message key = "count.one" bundle = "${lang}"/><br/> <fmt:message key = "count.two" bundle = "${lang}"/><br/> <fmt:message key = "count.three" bundle = "${lang}"/><br/> </body> </html>
You will receive the following result −
One Two Three
Advertisements