This demo started from a simple request on the OTN forum asking how would you go about creating a JSF page that reads and writes a file content.
The quick answer I gave was that you can do this with a simple Java class that you expose as a datacontrol. But then I started thinking there will be some more tricky parts that you'll need to do in order to get the UI and binding to work exactly as you would like. The trick is to merge the result of one operation to be the input for the other operation. I played around with the solution I provided and decided to record this since there are a few steps here that will be useful to refer people to in the future.
The "Tricky Parts" that demo shows are:
1. Creating a data control from a simple Java class
2. Binding with ADF Parameter Form to invoke methods
3. Setting the value for method's parameters using the binding tab
4. Creating a backing bean for a JSF page
5. Modifying a default ADF method in a backing bean
5. Accessing an ADF binding control value in your backing bean
6. Binding an existing JSF components to a backing bean
7. Deleting a component from a JSF page without deleting it's binding
Here is the demo:
I hope this helps.
(And sorry that I got a phone call and an IM while recording :-) )
Comments (5)
Thanks Shay !
As always very simple and lucid explanation.
1. One question though. Could we have populated the return value of 'readFile' directly (using EL declaratively) into the text box bound to the writeFile input variable? This would have eliminated creating a backing bean isnt it?
2. I have not been able to understand binding API completely. How did the ControlBinding class for the 'Return' binding get converted into String used in setValue() method? Shouldnt it have needed 'inputValue' of Return binding? (just like we use in EL bindings.return.inputValue).
Please advice.
PS. ScreenToaster widget doent allow us to scroll thru the video and finding what we want sometimes requires us to go thru the entire tutorial :)
Posted by husain | August 4, 2009 1:08 PM
Posted on August 4, 2009 13:08
Husain,
The tricky part is that the return value from the read operation is in a "read-only" mode - so if you used that EL as the value for the inputTextItem for the writeFile - it would have turned it into an output text.
I'm guessing this also explains the reason you didn't need the inputValue.
Posted by shay | August 4, 2009 1:16 PM
Posted on August 4, 2009 13:16
You are right. I tried to use a richTextEditor to display a value from a java file and used EL #{bindings.return.inputValue} and the RTE was displayed as output text. However I tried to put the EL #{bindings.return} and it does seem to work now.
Is it possible to share your code or is it possible that i send you my code that worked?
Thanks,
Husain
Posted by husain | August 5, 2009 6:49 AM
Posted on August 5, 2009 06:49
Shay,
Did you post the project for this example anywhere?
thx,matt
Posted by Matt Orsie | November 16, 2009 10:04 AM
Posted on November 16, 2009 10:04
Matt,
You can get the workspace for this blog here:
https://codesamples.samplecode.oracle.com/servlets/tracking/id/S478
Shay
Posted by shay | November 16, 2009 3:09 PM
Posted on November 16, 2009 15:09