Monday, November 15, 2010
Sunday, November 14, 2010
Building ADF Jar using maven
You can build ADF jar using maven.
Steps:
In order to build ADF application using maven you need to add 2 plug-ins to the POM file
1. compiler plugin
2. ant plugin.
Ant plugin is used to run the ojdeploy build xml file.
ojdeploy build xml should have the deployment profile information.
Steps:
In order to build ADF application using maven you need to add 2 plug-ins to the POM file
1. compiler plugin
2. ant plugin.
Ant plugin is used to run the ojdeploy build xml file.
ojdeploy build xml should have the deployment profile information.
Declarative way to allow an action to set value before navigation
On Actions like CommandButton, CommandLink,.. you can allow them to set value before navigating to another page by using <af:setActionListener>
Example:
<af:commandLink text="#{row.formattedName}" id="cl1" action="toSavePage">
<af:setActionListener from="phoneNumber" to="#{pageFlowScope.phoneNum}"/>
<af:setActionListener from="#{row.empId}" to="#{pageFlowScope.selectedEmployeeId}"/>
</af:commandLink>
Example:
<af:commandLink text="#{row.formattedName}" id="cl1" action="toSavePage">
<af:setActionListener from="phoneNumber" to="#{pageFlowScope.phoneNum}"/>
<af:setActionListener from="#{row.empId}" to="#{pageFlowScope.selectedEmployeeId}"/>
</af:commandLink>
Default jsff/jspx page in Source Mode rather than WYSIWYG design editor
To change default setting of opening jsff/jspx page in WYSIWYG editor to source mode:
Tools --> Preferences -->File Types --> select Default Editors --> select jsff page --> select default editor to source.
Displaying html code on a ADF Fragment/Page
2 ways you can display html code on a page in ADF
<af:outputText id="ot1" escape="false" value="html code value goes here.."/>
or
<af:richTextEditor label="htmlContent" id="rte1" columns="50" readOnly="true"
value="html code value goes here.."
simple="true" editMode="source" rows="25"/>
<af:outputText id="ot1" escape="false" value="html code value goes here.."/>
or
<af:richTextEditor label="htmlContent" id="rte1" columns="50" readOnly="true"
value="html code value goes here.."
simple="true" editMode="source" rows="25"/>
Disable autocomplete fields on the Form using javascript in ADF
Add below lines at the end of each jsff page.
<trh:script id="trh1">
function disableAutoCompleteFormData()
{
for(i=0; i!=document.getElementByTagName('FORM').length;i++){
document.getElementsByTagName("FORM")[i].setAttribute('autocomplete','off');
}
}
</trh:script>
<trh:script id="trh1">
function disableAutoCompleteFormData()
{
for(i=0; i!=document.getElementByTagName('FORM').length;i++){
document.getElementsByTagName("FORM")[i].setAttribute('autocomplete','off');
}
}
</trh:script>
Show pop up from manage bean
public static void showPopup(String clientId)
{
FacesContext context = FacesContext.getCurrentInstance();
StringBuilder script = new StringBuilder();
script.append("var popup = AdfPage.PAGE.findComponent('")
.append(clientId)
.append("'); ")
.append("if (!popup.isPopupVisible()) { ")
.append("popup.show();}");
ExtendedRenderKitService erks = Service.getService(context.getRenderKit(),
ExtendedRenderKitService.class);
erks.addScript(context, script.toString());
}
clientId - The component id of the pop up.
{
FacesContext context = FacesContext.getCurrentInstance();
StringBuilder script = new StringBuilder();
script.append("var popup = AdfPage.PAGE.findComponent('")
.append(clientId)
.append("'); ")
.append("if (!popup.isPopupVisible()) { ")
.append("popup.show();}");
ExtendedRenderKitService erks = Service.getService(context.getRenderKit(),
ExtendedRenderKitService.class);
erks.addScript(context, script.toString());
}
clientId - The component id of the pop up.
Evaluating EL expression in Manage Bean
public static Object evaluateEL(String el) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext, el,
Object.class);
return exp.getValue(elContext);
}
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext, el,
Object.class);
return exp.getValue(elContext);
}
Get/Set pageFlowScope variable from manage bean
Set pageFlowScope variable:
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("key", "value");
Get pageFlowScope:
Map map = AdfFacesContext.getCurrentInstance().getPageFlowScope();
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("key", "value");
Get pageFlowScope:
Map map = AdfFacesContext.getCurrentInstance().getPageFlowScope();
Subscribe to:
Posts (Atom)