Requirement: I have a demo.jsf page. In that page I have three af:outputText. I have a resourceBundle.properties where I have the values for all the three af:outputText. I want to set values to the af:outputText through bean, mean first I will get the resourceBundle.properties values in the java bean (MyBean) and from bean I will set the values to the three af:outputText in the demo.jsf page.
Please note: We can easily set the values to the three af:outputText directly without using the java bean, but there will be a scenarios where it is not advisable to do so. Thinking of those scenarios, I have posted this requirement and its solution.
Solution: For solution to the above requirement follow the below steps:
Step 1: Create an Oracle ADF Fusion Web Application.
Step 2: Create a demo.jsf page in the ViewController project of our application.
Step 3: Drag and drop three af:outputText from the component panel on the demo.jsf page. Please note I have also used one af:panelGroupLayout and two af:spacer, but these two components that is af:panelGroupLayout and af:spacer is just for alignment purpose, and nothing else.
Step 4: Create a resourceBundle.properties and put three key values pair as shown below. These three values I will be displaying in the demo.jsf through Java code.
Step 5: Create a backingBean named “MyBean” and write the below code:
Step 6: Set the values of the three af:outputText in the demo.jsf page as shown below. The value that each af:outputText is referring is defined in the MyBean code.
Step 7: Save all and run the application. Thus, the ran application is shown below.
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
615 total views, 1 views today