In any web application we need to define labels, hints , tooltips and more. Also our application may be deployed for multiple languages users. In ADF we can achieve having bundle for each language.
Example :-
English :- Model_En.properties , ViewController_En.properties
Spanish :- Model_Sp.properties , ViewController_Sp.properties
It will be easy to dynamically switch from one bundle to another during run time.
1. Create Fusion Project and create EO/VO , We don’t see any resource bundle here.
2. By Default attribute name will come as label , Until we override this value.
3. Override the label in the control hints property of attribute , We can use any EO/VO to give control hint , but I prefer to use EO.
If we give this value and click OK , it will create following resource bundle file.
View Controller Bundle
In Product list page we will place some button and name it as “Create New” label which will come from view controller bundle.
Right click view controller project properties and set the following value in Resource Bundle
Select the command button and select following
Give following value and don’t forget to select View-Controller Bundle.
ViewController bundle contains following properties
To refer this value use
#{viewcontrollerBundle['hasim.createrow']} which will print Create Row.
This bundle is loaded in JSF with following JSF Tag.
Putting view controller bundle in faces-config.xml
Instead of giving above JSF tag in all JSPX pages , we should generalize this definition ,so that we don’t have to provide this tag on every JSF pages.
open face-config.xml and enter following properties in faces-config.xml
We can see we are referring our variable as bundle which is pointing to our view controller bundle.
Now comment the JSF tag referring to bundle.
Now click expression builder
Now you will see it is visible in following window.
Just click this which will automatically populate the expression part.
Enjoy !
very useful and well explained.
ReplyDelete