Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CedricL46/165d8963d5ac07482c8354d41728676b to your computer and use it in GitHub Desktop.
Save CedricL46/165d8963d5ac07482c8354d41728676b to your computer and use it in GitHub Desktop.
//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