Home Jsf JSF loadBundle Tag
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

JSF loadBundle Tag

Advertisement
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"/>
<f:view>
   <html>
   <body>
   <h:form>
   <h:outputText value="#{mes.greeting_text}" />
   </h:form>
   </body>
   </html>
</f:view>

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

greeting_text=Welcome In Roseindia JSF Tutorial

Rendered Output :

Html Source Code :

<html>
<body>
<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>

</body>
</html>

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.

Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 15, 2007

Ask Questions?    Discuss: JSF loadBundle Tag   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com