ADF Faces with EJB 3.0 Web services is among famous combination architects are committing to. It has its own winning and loosing grounds over ADFBc.
One of the issues that I found many developers struggle with is refresh of IteratorBinding, especially in scenario when repeated calls are made to same method binding. We found that sometimes, for reason yet to be discovered, iterator is not loaded with the fresh data.
One approach toward this issue is making use of Refresh Property which could be set to various values in drop down like always, default, ifNeeded, never etc. This is declarative approach and you should try it before attempting programmatically.
However if this doesn't works you can try invalidateCache() on the DCIteratorBinding. This too could be set declarative by setting cache result to false.. but some developers didn't had positive experience including me.
Naive
Oracle ADF
Friday, July 15, 2011
Tuesday, June 14, 2011
ADF, JSF 2.0 and Facelets
Release of Oracle JDeveloper 11.1.2.0 raised many questions on the support of JSF 2.0, Facelets, migration of existing ADF applications. Ofcourse there is no utility yet that could migrate current ADF application directly to the 11.1.2.0 platform but many questions can be answered by Franks article 'JavaServer Faces 2.0 Overview and Adoption Roadmap in Oracle ADF Faces and Oracle JDeveloper 11g'. If you are one interested to learn more on this, you can download the article here.
Saturday, June 11, 2011
How do I get an LOV / Select One Choice label / Display Attribute in bean?
This is one question that I see in forums all the time. You can find other solution of this issue in oracle forum along with my solution which goes as here:
1. Bind af:selectOneChoice to the bean say. testSOCbindings
2. Bind the f:selectItems to the bean say. testSOCSelectItems
3. Use below code:
Integer i = (Integer) getTestSOCbindings().getValue();
List silist = (List) getTestSOCSelectItems().getValue();
String val = silist.get(i.intValue()).getLabel();
1. Bind af:selectOneChoice to the bean say. testSOCbindings
2. Bind the f:selectItems to the bean say. testSOCSelectItems
3. Use below code:
Integer i = (Integer) getTestSOCbindings().getValue();
List
String val = silist.get(i.intValue()).getLabel();
How to access WSDL from weblogic server ?
This was one of the question that was posted a a use in Oracle Forum. If you are also looking for the similar one here is the solution:
In Weblogic server .. go to Home >Summary of Deployments
Expand your service application and go the webservice.. click on the web service link ..
You will be navigated to its details.. then click on Testing.. expand the service..
Here you should see WSDL link and Test Client link.. using test client you can even test your web service method.
In Weblogic server .. go to Home >Summary of Deployments
Expand your service application and go the webservice.. click on the web service link ..
You will be navigated to its details.. then click on Testing.. expand the service..
Here you should see WSDL link and Test Client link.. using test client you can even test your web service method.
oracle.jbo.NoDefException: JBO-25002: Definition .PageDef of type Form Binding Definition is not found.
ADF error stack is definetly not very user friendly and there are times when you solely get depenedend on forums or google to get some hint of the solution but one would also settle if you can figure the cause of it.
oracle.jbo.NoDefException: JBO-25002: Definition.PageDef of type Form Binding Definition is not found.
is one of those exceptions. There are couple of forum post post to it but solution is vague and its get hard to interpret what the solution was. Well, if you get into this issue here is the cause.
DataBinding.cpx is missing definitionFactories tags. So as a solution add below tag to the DataBinding.cpx inside Application Tag and before PageMap tag:
oracle.jbo.NoDefException: JBO-25002: Definition
is one of those exceptions. There are couple of forum post post to it but solution is vague and its get hard to interpret what the solution was. Well, if you get into this issue here is the cause.
DataBinding.cpx is missing definitionFactories tags. So as a solution add below tag to the DataBinding.cpx inside Application Tag and before PageMap tag:
Wednesday, February 16, 2011
Passing Parameters from JavaScript to Manage/Backing bean
Sometimes you cannot avoid using JavaScript even if that is not the very recommended approach with ADF. However when doing the same there is often need to pass values from java script function to bean. If you got yourself in scenario like this.. here is how you can do it.
In your JavaScript method you can assign the values to param and pass it to the event.
function myClientListener(event){
var element = event.getSource();
var param = {city:"New York", country:"US"};
AdfCustomEvent.queue(element, "jsServerListener", param, true);
event.cancel();
}
In your page associate this event to a handler method from java bean
<af:serverListener type="jsServerListener"
method="#{MyBean.serverEventHandler}"/>
Now in bean here is how you can get access to it:
public void serverEventHandler(ClientEvent clientEvent) {
System.out.println(clientEvent.getParameters().get("city"));
System.out.println(clientEvent.getParameters().get("country"));
}
In your JavaScript method you can assign the values to param and pass it to the event.
function myClientListener(event){
var element = event.getSource();
var param = {city:"New York", country:"US"};
AdfCustomEvent.queue(element, "jsServerListener", param, true);
event.cancel();
}
In your page associate this event to a handler method from java bean
method="#{MyBean.serverEventHandler}"/>
Now in bean here is how you can get access to it:
public void serverEventHandler(ClientEvent clientEvent) {
System.out.println(clientEvent.getParameters().get("city"));
System.out.println(clientEvent.getParameters().get("country"));
}
Tuesday, February 15, 2011
Shifting Focus on Page and Popup using Arrow Keys.
Recently I found many threads in forum inquiring about shifting focus on components via arrow keys. There are no build in properties in adf component that can do this. In order to achieved with the combination of ClientListener and JavaScript.
As we know ClientListener can be used to capture the client event and can raise JavaScript function against it and in the function you can shift the focus to any desired components on the UI.
So here is the test case which has two parts:
1. On the page we have two af:commandButtons named as 'Save' and 'Cancel'. Once the focus is on any of the two button we can use Right Arrow Key and Left Arrow Key to shift the focus between then.
2. Same behavior is simulated for the buttons in the popup. This was added to cover one specific issue posted in Oracle forum. In this case a button is provided to launch a popup which contains Dialog. Two commandbutton is dropped inside the toolbar facet. And once the focus is on any of the command buttons they can be shifted using Right and Left Arror Keys.
Here is the javascript code:
and here is the code for the Jspx file:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:resource type="javascript" source="/javascript/MyJavaScript.js"/>
<af:form id="f1">
<af:panelHeader text="Change Focus on components directly on Page." id="ph1">
<f:facet name="context"/>
<f:facet name="menuBar"/>
<f:facet name="toolbar"/>
<f:facet name="legend"/>
<f:facet name="info"/>
<af:spacer height="30" id="spacer1"/>
<af:commandButton text="Save" id="commandButton1">
<af:clientListener method="shiftFocusToCancel" type="keyUp"/>
</af:commandButton>
<af:commandButton text="Cancel" id="commandButton2">
<af:clientListener method="shiftFocusToSave" type="keyUp"/>
</af:commandButton>
</af:panelHeader>
<af:spacer height="30" id="spacer2"/>
<af:panelHeader text="Change Focus on components on Popup."
id="panelHeader1">
<f:facet name="context"/>
<f:facet name="menuBar"/>
<f:facet name="toolbar"/>
<f:facet name="legend"/>
<f:facet name="info"/>
<af:spacer height="30" id="s1"/>
<af:commandButton text="Click me to launch Popup." id="cb3"
partialSubmit="true">
<af:showPopupBehavior popupId="p1" triggerType="click"/>
</af:commandButton>
<af:popup id="p1">
<af:dialog id="d2" type="none">
<f:facet name="buttonBar">
<af:group id="g1">
<af:commandButton text="OK" id="cb1">
<af:clientListener method="shiftFocusToPopupCancel"
type="keyUp"/>
</af:commandButton>
<af:commandButton text="Cancel" id="cb2">
<af:clientListener method="shiftFocusToPopupOK" type="keyUp"/>
</af:commandButton>
</af:group>
</f:facet>
<af:outputFormatted value="You have got a popup!" id="of1"/>
</af:dialog>
</af:popup>
</af:panelHeader>
</af:form>
</af:document>
</f:view>
</jsp:root>
As we know ClientListener can be used to capture the client event and can raise JavaScript function against it and in the function you can shift the focus to any desired components on the UI.
So here is the test case which has two parts:
1. On the page we have two af:commandButtons named as 'Save' and 'Cancel'. Once the focus is on any of the two button we can use Right Arrow Key and Left Arrow Key to shift the focus between then.
2. Same behavior is simulated for the buttons in the popup. This was added to cover one specific issue posted in Oracle forum. In this case a button is provided to launch a popup which contains Dialog. Two commandbutton is dropped inside the toolbar facet. And once the focus is on any of the command buttons they can be shifted using Right and Left Arror Keys.
Here is the javascript code:
and here is the code for the Jspx file:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:resource type="javascript" source="/javascript/MyJavaScript.js"/>
<af:form id="f1">
<af:panelHeader text="Change Focus on components directly on Page." id="ph1">
<f:facet name="context"/>
<f:facet name="menuBar"/>
<f:facet name="toolbar"/>
<f:facet name="legend"/>
<f:facet name="info"/>
<af:spacer height="30" id="spacer1"/>
<af:commandButton text="Save" id="commandButton1">
<af:clientListener method="shiftFocusToCancel" type="keyUp"/>
</af:commandButton>
<af:commandButton text="Cancel" id="commandButton2">
<af:clientListener method="shiftFocusToSave" type="keyUp"/>
</af:commandButton>
</af:panelHeader>
<af:spacer height="30" id="spacer2"/>
<af:panelHeader text="Change Focus on components on Popup."
id="panelHeader1">
<f:facet name="context"/>
<f:facet name="menuBar"/>
<f:facet name="toolbar"/>
<f:facet name="legend"/>
<f:facet name="info"/>
<af:spacer height="30" id="s1"/>
<af:commandButton text="Click me to launch Popup." id="cb3"
partialSubmit="true">
<af:showPopupBehavior popupId="p1" triggerType="click"/>
</af:commandButton>
<af:popup id="p1">
<af:dialog id="d2" type="none">
<f:facet name="buttonBar">
<af:group id="g1">
<af:commandButton text="OK" id="cb1">
<af:clientListener method="shiftFocusToPopupCancel"
type="keyUp"/>
</af:commandButton>
<af:commandButton text="Cancel" id="cb2">
<af:clientListener method="shiftFocusToPopupOK" type="keyUp"/>
</af:commandButton>
</af:group>
</f:facet>
<af:outputFormatted value="You have got a popup!" id="of1"/>
</af:dialog>
</af:popup>
</af:panelHeader>
</af:form>
</af:document>
</f:view>
</jsp:root>
Subscribe to:
Posts (Atom)