Get the display value of selectonechoice or LOV in bean – Oracle ADF

I found one approach to get the display value of LOV in managed bean using  ADFUtils.evaluateEl method.

Say if you have a value change listener for an lov,  valueChangeEvent.getNewValue() gives the index of the value. To get the display value of the lov, use below logic  :

public void onDeptNameChange(ValueChangeEvent valueChangeEvent) {

Object deptNameAttribute = ADFUtils.evaluateEL("#{bindings.deptName.items['"+valueChangeEvent.getNewValue().toString()+

"'].label}");

String deptNameStr = deptNameAttribute .toString();  // This should have the selected display value of lov.

}

Say if you want to access the display value of LOV, in any other method, other than valueChange listener, then use below code :

Object deptNameAttribute = ADFUtils.evaluateEL("#{bindings.deptName.items['"+ADFUtils.getBoundAttributeValue("deptId")+"'].label}");

Here deptId is the code of this lov.  Hope this is helpful.

Happy learning with Techartifact……

Oracle ADF certification

Yesterday, I had given the Oracle Application Development Framework 11g Essentials exam (1Z0-554). I passed it and I am now an Application Development Framework Implementation specialist.
Tricky questions were based on ADF BC (Business Components) & ADF UI. Having BC experience is a must for taking the exam. There were 79 questions that i had to answer in 105 minutes .Passing percentage 61%. I completed in around 75 minutes. The questions were above standard and i enjoyed the test .There are few question of Many to many relationship between Table as well.

Tips for new candidates -Tricky question based on life cycle .Focus on ADF BC. Reuse example

For more details, check this:http://www.oracle.com/partners/en/knowledge-zone/middleware/adf-exam-page-322499.html

O_Certified Specialist_clr

Soon i will posting more article not questions for sure , which helps for preparation of this exam.

Happy leaning with Vinay Kumar in Techartifact…..

Fetching server name and port number for ADF application

Requirement – How to get server name and server port.
Solutions- You can get this information in by writing below code in java

FacesContext fctx = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) fctx.getExternalContext ().GetRequest ();
String serverName = request.getServerName();
int serverPort =request.getServerPort();

System.out.println ("Server Name:" + serverName);
System.out.println ("Server Port no:" + server port);

Happy coding with Vinay Kumar in Techartifact.