Jstl Format Bundle Tag
π
2026-06-18 | π JSTL
[JSP Standard Tag Library](#)
The `` tag makes the specified resource bundle available to the `` tags that appear within it. This can save you many steps of specifying the resource bundle for each `` tag.
For example, the following two `` blocks will produce the same output:
### Syntax
<fmt:bundle baseName="" prefix=""/>
### Attributes
The `` tag has the following attributes:
| **Attribute** | **Description** | **Required** | **Default Value** |
| --- | --- | --- | --- |
| basename | Specifies the base name of the resource bundle to be loaded. | Yes | None |
| prefix | Specifies the prefix for the key attribute of the `` tag. | No | None |
* * *
## Program Example
Resource bundles contain locale-specific objects. Resource bundles contain key-value pairs. When your program needs locale-specific resources, you can share all the keys for all locales, but also specify translated values for a locale. Resource bundles help provide content tailored to a locale.
A Java resource bundle file contains a series of key-value pairs. The method we are focusing on involves creating a compiled Java class that inherits from the `java.util.ListResourceBundle` class. You must compile these classes and place them in your web application's CLASSPATH.
Let's define a default resource bundle:
package com.tutorial;import java.util.ListResourceBundle;public class Example_En extends ListResourceBundle { public Object[][] getContents() { return contents; } static final Object[][] contents = { {"count.one", "One"}, {"count.two", "Two"}, {"count.three", "Three"}, };}
Compile the above file into `Example.class`, then place it where the web application's CLASSPATH can find it. Now you can use JSTL to display these three numbers, like this:
JSTL fmt:bundle Tag
The result is as follows:
One Two Three
Change it to remove the prefix attribute:
JSTL fmt:bundle Tag
The result is as follows:
One Two Three
You can refer to [](#) and [](#) for more information.
* * JSP Standard Tag Library](#)