Wednesday, September 24, 2014

Disable the af:column reordering in Oracle ADF af:table

Setting the following property in af:table will not allow the end user to reorder the columns of the af:table

 disableColumnReordering="true"

Tuesday, September 23, 2014

Check Equals Ignore case in EL expression in JSF/ADF


Step1: Add the below highlighted library

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions"
          xmlns:c="http://java.sun.com/jsp/jstl/core">
        

Step2: Check the condition as below
         
<af:image shortDesc="Status Open"
        id="i7"
        rendered="#{fn:toLowerCase(sessionScope.status) == fn:toLowerCase('open')}
        source="/images/status-open.png"/>

Monday, September 22, 2014

Get the hostname and context root in managed bean in ADF

    public FacesContext getFacesContext() { 
      return FacesContext.getCurrentInstance(); 
    } 
   
    public ExternalContext getExternalContext() { 
      return getFacesContext().getExternalContext(); 
    }
   
    public void getRequestAPartURL() {
        HttpServletRequest request =
            (HttpServletRequest)getExternalContext().getRequest();

        // Get the current URL
        String requestUrl = request.getRequestURL().toString();

        // Get the context root
        String contextRoot = getExternalContext().getRequestContextPath();
       
       // Get host and port number
       requestUrl = requestUrl.substring(0, requestUrl.indexOf(contextRoot))
    }

JBO-25058: Definition RowNum of type Attribute not found in VO Exception - ADF Solution


 Sometimes we run into the following error. This error occurs because of the corrupted Iterator in the page definition file. Re-creating the iterator will solve the issue

Complete Error message

oracle.jbo.NoDefException: JBO-25058: Definition RowNum of type Attribute is not found in VO.
    at oracle.jbo.uicli.binding.JUCtrlValueBinding.findAttributeDef(JUCtrlValueBinding.java:598)
    at oracle.jbo.uicli.binding.JUCtrlValueBinding.findAttributeDef(JUCtrlValueBinding.java:568)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding.__setSortCriteria(FacesCtrlRangeBinding.java:249)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.setSortCriteria(FacesCtrlHierBinding.java:406)
    at org.apache.myfaces.trinidad.component.UIXTable.postCreateCollectionModel(UIXTable.java:473)
    at org.apache.myfaces.trinidad.component.UIXCollection.__flushCachedModel(UIXCollection.java:1443)
    at org.apache.myfaces.trinidad.component.UIXCollection.invokeOnComponent(UIXCollection.java:1060)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1539)
    at org.apache.myfaces.trinidad.component.UIXDecorateCollection.invokeOnComponent(UIXDecorateCollection.java:121)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1539)
    at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:622)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1489)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1583)
    at oracle.adf.view.rich.component.rich.RichDocument.invokeOnComponent(RichDocument.java:168)
    at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:720)
    at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._fixClientIds(LifecycleImpl.java:1199)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:534)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:207)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

Friday, September 19, 2014

Change the weblogic server admin password from command line of console is not starting?

1.    Go to this path: SYS_DIR\DefaultDomain\bin,  where SYS_DIR is the path we defined above.
2.    Execute the setDomainEnvironment.cmd
3.    Go to this path: SYS_DIR\DefaultDomain\security
4.    Rename the DefaultAuthenticatorInit.ldift file to something like oldDefaultAuthenticatorInit.ldift
5.    Execute the following command in order to create the new password.
  •       Notice that the command has a dot at the end, this is necessary so the new password is created in the current directory.
  •       Change NEW_PASSSWORD for the new password of the weblogic user:
  •        We should have the weblogic.jar in the classpath

                 java weblogic.security.utils.AdminAccount weblogic NEW_PASSWORD .

6.    Go to this path: SYS_DIR\DefaultDomain\servers\DefaultServer\data\ldap
7.    Rename the ldap directory to something like ldap_old
8.    Go to this path: SYS_DIR\DefaultDomain\servers\DefaultServer\security
9.    Rename the boot.properties file to something like oldboot.properties
10.    Create a new boot.properties file in the same directory. This is necessary if you want autologin when launching the Weblogic server from within JDeveloper. The content of the file should be something like the following (change NEW_PASSWORD for the password you defined in previous steps):

username=weblogic
password=NEW_PASSWORD

11.    Start the integrated weblogic server from  jdeveloper
12.    Open a new browser and enter the following URL (the port may be different for you):
http://localhost:7101/console
13.    The Weblogic server console application should display and you can login with your new credentials.

Monday, September 15, 2014

How to turn off the default features of af:panelCollection in Oracle ADF?

By default whenever we surround af:table component with af:panelCollection we get a lot of features to reorder the columns, show only particular columns, free particular columns etc..

If we would like to disable them we have to use the featureOff property of the panelCollection. That featureOff property manages the visibility of certain controls / features of panelCollection to the end user.

 Comprehensive list of the features that can be turned off are

Value Turns off
statusBar Status bar
viewMenu 'View' menu
formatMenu 'Format' menu
columnsMenuItem 'Columns' sub-menu item
columnsMenuItem:col1,col20 Columns with column ID: 'col1' and 'col20' inside 'Columns' sub-menu
freezeMenuItem 'Freeze' menu item
detachMenuItem 'Detach' menu item
sortMenuItem 'Sort' menu item
reorderColumnsMenuItem 'Reorder Columns' menu item
resizeColumnsMenuItem 'Resize Columns' menu item
wrapMenuItem 'Wrap' menu item
showAsTopMenuItem Tree/TreeTable 'Show As Top' menu item
scrollToFirstMenuItem Tree/TreeTable 'Scroll To First' menu item
scrollToLastMenuItem Tree/TreeTable 'Scroll To Last' menu item
freezeToolbarItem 'Freeze' toolbar item
detachToolbarItem 'Detach' toolbar item
wrapToolbarItem 'Wrap' toolbar item
showAsTopToolbarItem Tree/TreeTable 'Show As Top' toolbar item
wrap 'Wrap' menu and toolbar items
freeze 'Freeze' menu and toolbar items
detach 'Detach' menu and toolbar items

In this article, we will find out what happens at runtime when different values are specified for this attribute (Note : This attribute takes a space-separated list of default features to be turned off for the panelCollection - as mentioned above)

More details can be found here

Thursday, September 4, 2014

Everything about Oracle ADF Shared Application Module

I have found a good documentation about the shared application module and their effective use, refer to the below link for the same

http://docs.oracle.com/middleware/1212/adf/ADFFD/bclookups.htm

Display watermark on af:inputText in ADF 11g using javscript


Sometimes we would like to display the watermark on the af:inputText component in oracle ADF and remove the text on mouse click or focus on that input text. We can achieve this using the Java script code as below. The snapshot of look and feel is also added.

Look and Feel Snapshot




  Step1: Add the following code to the application javascript file

<af:resource type="javascript">
    function adf$noValueText$intialize(event) {
        var component = event.getSource();
        component.visitChildren(adf$noValueText$replaceEmptyWithText, null, false);
    }
   
    function adf$noValueText$onFocus(event) {
        adf$noValueText$replaceTextWithEmpty(event.getSource());
    }
   
    function adf$noValueText$onBlur(event) {
        adf$noValueText$replaceEmptyWithText(event.getSource());
    }
   
    function adf$noValueText$replaceTextWithEmpty(component) {
        var noValueText = component.getProperty("noValueText");
        if (typeof noValueText != 'undefined') {
            var domNode = document.getElementById(component.getClientId() + "::content");
            if (domNode.value == component.getProperty("noValueText")) {
                domNode.value = "";
            }
        }
    }
   
    function adf$noValueText$replaceEmptyWithText(component) {
        var noValueText = component.getProperty("noValueText");
        if (typeof noValueText != 'undefined') {
            var domNode = document.getElementById(component.getClientId() + "::content");
            if (domNode.value == "") {
                domNode.value = component.getProperty("noValueText");
            }
        }
    }
</af:resource>


Step2: Add the following code to your jsff

<af:clientListener method="adf$noValueText$intialize" type="load">

<af:inputText label="" value="WaterMark" id="it" />
       <af:clientAttribute name="noValueText" value="WaterMark Text"/>
       <af:clientListener method="adf$noValueText$onFocus" type="focus"/>
       <af:clientListener method="adf$noValueText$onBlur" type="blur"/>
</af:inputText>

Tuesday, September 2, 2014

Oracle ADF RichInputText setValue/getValue issue and the solution

Sometimes we observe that the value entered in the Oracle ADF af:inputText component doesn't get refreshed and the previous value is stored as it is. We can get rid of this using the following code

import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.context.AdfFacesContext;

RichInputText rit = (RichInputText)JSFUtils.findComponentInRoot(id);
rit.setSubmittedValue(null);
rit.resetValue();
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(rit);