Monday, March 5, 2012

How to get a Value of SelectOneChoice Component in Backing bean?

There is a no way to get the short code of selected Value for component using ADF framework in Managed bean or backing bean, It always returns 'Index' instead actual value, This is a bug with ADF framework. The easy workaround to achieve this functionality is as below

// This will set the new Index value 

JSFUtils.setExpressionValue("#{bindings.FuelSrchrgRateUom.inputValue}",
                                valueChangeEvent.getNewValue());
// Get thhe value associated to new Index which already set in above step
String shortCd= (String) JSFUtils.resolveExpression("# {bindings.FuelSrchrgRateUom.inputValue} ");Here "bindings.ExecuteWithParams_BindComponent" is defined in Page def binding.

public static Object resolveExpression(String expression)
{
FacesContext fc = getFacesContext();
Application application = fc.getApplication();
ELContext elCtx = fc.getELContext();
ExpressionFactory elFact = application.getExpressionFactory();
ValueExpression valExp = elFact.createValueExpression(elCtx, expression, Object.class);
return valExp.getValue(elCtx);
}


Alternative way is







1 comment:

  1. If you'd like an alternative to casually approaching girls and trying to figure out the right thing to do...

    If you'd rather have women hit on YOU, instead of spending your nights prowling around in noisy pubs and night clubs...

    Then I encourage you to watch this eye-opening video to unveil a weird secret that can literally get you your very own harem of beautiful women just 24 hours from now:

    Facebook Seduction System!!!

    ReplyDelete