Last active
August 4, 2022 11:26
-
-
Save CedricL46/165d8963d5ac07482c8354d41728676b to your computer and use it in GitHub Desktop.
See full article here : https://cedricleruth.com/how-to-retreive-the-value-of-an-iterator-binding-variable-programmatically-in-adf/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Here is how to simply retreive the value of and ADF Binding from the view El Expression : | |
//Below is a view example with values taken from an ADF View Object | |
<af:inputText id="it1" autoSubmit="true" value="#{bindings.YOUR_VO.YOUR_VO_ATTRIBUTE.inputValue}" /> | |
<af:table value="#{bindings.YOUR_VO.collectionModel}" var="row"> | |
<af:column sortProperty="#{bindings.YOUR_VO.hints.YOUR_VO_ATTRIBUTE.name}" | |
id="c1"> | |
<af:outputText value="#{row.YOUR_VO_ATTRIBUTE}" id="ot1"/> | |
</af:column> | |
</af:table> | |
//Using below function you can easily get any of those value in your ADF Bean as follow : | |
//Note: replace String by the correct type | |
String inputTextValue= (String)resolveExpression("#{bindings.YOUR_VO.YOUR_VO_ATTRIBUTE.inputValue}"); | |
String currentRowValue= (String)resolveExpression("#{row.YOUR_VO_ATTRIBUTE}"); | |
/** | |
* Method for taking a reference to a JSF binding expression and returning | |
* the matching object (or creating it). | |
* @param expression EL expression | |
* @return Managed object | |
* @author : Duncan Mills, Steve Muench and Ric Smith's JSFUtils class https://github.com/CedricL46/Oracle-ADF-and-JSF-Utils-libraries | |
*/ | |
public static Object resolveExpression(String expression) { | |
FacesContext facesContext = getFacesContext(); | |
Application app = facesContext.getApplication(); | |
ExpressionFactory elFactory = app.getExpressionFactory(); | |
ELContext elContext = facesContext.getELContext(); | |
ValueExpression valueExp = elFactory.createValueExpression(elContext, expression, Object.class); | |
return valueExp.getValue(elContext); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment