24 April, 2013

OAF : Get Current Row in Table

Sometimes you want to get current row in table. To apply this you can use the following code in controller and write it inside processFormRequest method.

     public void processFormRequest(OAPageContext pageContext, 
                                   OAWebBean webBean) {
        super.processFormRequest(pageContext, webBean);
        //Get application Module
        OAApplicationModule am = pageContext.getApplicationModule(webBean);
        
        //Get Row Refrence
        String rowReference = 
            pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
            
        //Get current Row using Row Reference    
        OARow currRow = (OARow)am.findRowByRef(rowReference);
        
        //Get attribute value from current row
        String attrValue = (String)currRow.getAttribute("AttrName");
    }



Thanks

4 comments:

  1. String attrValue = (String)currRow.getAttribute("AttrName");
    Getting nuln pointer exception while doing this.

    ReplyDelete
  2. Getting null pointer for me too.. any idea how to fix it?

    ReplyDelete
  3. Getting null pointer for me too.. any idea how to fix it?

    ReplyDelete
    Replies
    1. if (null!=currRow){
      String attrValue = String.ValueOf(currRow.getAttribute("AttrName")) ;
      }

      Delete

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...