JSF loadBundle Tag

In this section, you will learn about the JSF loadBundle tag with example.

JSF loadBundle Tag


This tag is used to load the recourse bundle and store it as a map in the request scope. This allows you to access the message in your JSF. There are two attributes for this tag "basename" and "var". "basename" is the base name where the bundle is present and "var" represents the name by which the we will refer this bundle in our jsf page.

Code Description :

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<f:loadBundle basename="RB" var="mes"/>
   <h:outputText value="#{mes.greeting_text}" />

Resource Bundle file(RB.properties in WEB_INF/classes folder):

greeting_text=Welcome In Roseindia JSF Tutorial

Rendered Output :

Html Source Code :

<form id="_id0" method="post" action="/coretag/pages/resourceBundle.jsf" enctype="application/x-www-form-urlencoded">

Welcome In Roseindia JSF Tutorial

<input type="hidden" name="_id0" value="_id0" /></form>


Attributes that this tag uses are given below :

basename : It is used to provide the name of the base of the resource bundle which is to be loaded and used in our pages.
var :
This is used to give the name of the attribute in request scope, where the bundle is stored as a map, to access the bundle by this name.

Share on Google+Share on Google+

JSF loadBundle Tag

Posted on: June 15, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: JSF loadBundle Tag   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image