Friday, 24 May 2019

Using <f:viewParam/> in Oracle ADF


Wow! its beauty of ADF or FACETS , Here i am explain about <f:viewparam/> .

We have client requirement , user should navigate from another application that should pass URL params.

http://{hostname}/ApplicationName/faces/view1?varParam1=value1&varParam2=value2


Using unbounded taskflow , 


We will use directly #{param.varParam1}  and #{param.varParam2}on first page load .but navigating from first page to second page those URL params will be disappear and lost once we come back from second page to first page.

So to overcome this scenario use <f:viewParam/> like below so that we will maintain the values through the session.

 If we want to maintain the URL params values throughout the session we should use like below.

<af:document id="d1">
<f:metadata>
            <f:viewParam id="vp1" name="varParam1" value="#{search_s.varParam1}"/>
            <f:viewParam id="vp2" name="varParam2" value="#{search_s.varParam2}"/>

        </f:metadata>
...
...
</af:document>

here search_s is the session bean. This session scope will maintain the varParam1 and varParam2 values.

Wednesday, 27 February 2019

How to prevent browser back button with alert to user. ?

<script type="text/javascript">
          history.pushState(null, null, document.URL);
          window.addEventListener('popstate', function () {
              alert("Please proceed with Main button");
              history.pushState(null, null, document.URL);

          });

Wednesday, 30 January 2019

Difference between two timestamps in SQL to get as hh24:mi:ss and As mi.sec



to_char(to_date('1970-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')+(column1.END_DATE_TIME-column2.START_DATE_TIME),'hh24:mi:ss') as TotalTimeTaken

  round(       
    (cast(EeMntrTxnHeaderEO.END_DATE_TIME as date) - cast(EeMntrTxnHeaderEO.START_DATE_TIME as date))       
    * 24 * 60      
  ,2) as TotalTimeTaken