You can download sample application - AccessPropertyFile.zip, which shows how I'm accessing property file entries from Backing bean methods. There are two buttons on the application page and one text component. Entries in property file:
- firstAction=First action processed
- secondAction=Second action processed
When developing described functionality, at first I have declared message bundle in faces-config.xml:
- Open faces-config.xml in JDeveloper
- Select Overview tab
- Choose Application option
- Declare property file in Message Bundle field (e.g. lt.andrejusb.resources.UIResources)
Entries in property file are accessed using function from JSFUtils class - getStringFromBundle(param). This become possible, after declaring message bundle in faces-config.xml. JSFUtils class source comes with standard JDeveloper sample application - SRDemo.
Thank you for the article, this helped me a lot.
ReplyDeletefrom Venezuela,
regards
thanks a lot but the link for the application is not working .
ReplyDeletethanks in advance .
Hi Andrejus,
ReplyDeleteI need your help on the below scenario:
I need a variable which is visible all through the application.
I tried with sessionScope but I'm losing the value when the control goes from one ViewController project to another.
I think I cant use the property file since the value in it needs to be changed.
Could you please give your suggestions.
Thanks,
Dinesh
May be you can use Application Scope?
ReplyDeleteAndrejus
Hi Andrejus,
ReplyDeleteThanks for the reply.
I too tried with the applicationScope but still when the control goes from one View Controller to another, I lost the value.
Thanks,
Dinesh
Then you can use DB as repository store.
ReplyDeleteAndrejus
This comment has been removed by the author.
ReplyDeleteHi Andrejus,
ReplyDeleteI'll try with the DB.
Thank you.
Thanks,
Dinesh
I can't access the zipped application to see in which directory you store the property file.
ReplyDeleteThis is quite old post... sorry I don't have this sample anymore...
ReplyDeleteAndrejus
is it possible to read value from an external property file.
ReplyDeleteas requirement is client want to keep property file at seperate place(due to several perprod/prod server).
so using class loader i am trying to read external property file, i added file name in weblogic classpath in commEnv.cmd file also but not able to load property file from there.
any help?
Thanks in advance!!
Reards
Apoorv Jain
Yes, instead of using property file, you should use Java class for resource bundle. You can initialize it from any external file.
ReplyDeleteAndrejus
Hi Andrejus,
ReplyDeleteIs it possible to read a property file (which is not part of Adf app. package)from ADF
Scenaio:I need a propery file which will be outside Adf app. If i want to make some changes i will make it in property file .so that each time if there is any changes i don't require to create EAR again for deployment.
Thanks in advance
Abhinav.