CommandButton action executing while Page Refresh

Hi,
I am developing an Application in ADF. I have a method in Backing Bean. I am associating this method to action Property of CommandButton in jspx Page.
<af:commandButton text="Submit"
action="#{backing_blockingRowWhileLoading.doNotExecuteOnPageRefresh}"
binding="#{backing_blockingRowWhileLoading.commandButton1}"
id="commandButton1"/>
This is the code in the backing bean
public String doNotExecuteOnPageRefresh()
System.out.println("postback loop");
return null;
When i am clicking the command Button the method is being executed and statement is being printed on the console. This is fine.
The problem is when i am pressing F5 or refreshing the browser the method is being executed once again.
Can i write the method in backing bean in such a way that it is executed only when th button is clicked. It shouldn't not be executed when page is refreshed using F5 or Refresh button of the browser.
I have tried with the below statement. It also failed.
if (!AdfFacesContext.getCurrentInstance().isPostback()){}
Can anyone please help me in solving this issue. This is very urgent for me. Thanks in advance.
Thank You,
Ravi kumar.

Hi Sireesha,
Thanks for helping me in solving the problem.
I have placed the below code in faces-config.xml and it solved the issue.
<navigation-rule>
<from-view-id>/blockingPageExecutionDuringPageRefresh.jspx</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/blockingPageExecutionDuringPageRefresh.jspx</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
Thank You,
Ravi kumar.

Similar Messages

  • Screen automatic refresh on a CommandButton action

    Hi,
    I have made two functions on the Application Module of my project wich are called by 2 ComandButtons from the web page. One of functions create a new file on the table displayed on the page, I need that because that table must no be changed by the users, and must be filled automaticly.
    The problems is when I press the button the row is create but there is no refresh on the screen, so y must to prees the "Go" button from the "Search" to get the row on the page table. How can I do the page refresh to be automatic?
    Thanks
    Tony

    Hi Steven,
    thank for you soon replay, but, where must I to add the executeQuery()? On the method of the application module I make a call to a PL/SQL proedure, so I create a PreparedStatement. I must to get another Statement to add the executeQuery() after the insert? I have tried to add the executeQuery method on that statement, but the screen is not refreshed.
    ps = this.getDBTransaction().createPreparedStatement("{call PAQUETE_CAJA.ABRIR_CAJA()}", 0);
    ps.execute();
    ps.close();
    Thanks
    Tony

  • Problem on page refresh calls previous action.

    Hi,
    I am using JDeveloper 11.1.1.4.0 R1. I have a jspx page with Add,Delete,Edit and Save actions.
    When I perform any action the page gets load successfully by completion the requested action.
    If I refresh(F5) the page then the previously performed action gets called again.
    e.g.
    suppose when I delete any record successfully and if I refresh the page then the method on delete button in bean gets called.
    It happens every time when I refresh the page.
    Regards,
    Amar.

    Hi,
    Its the normal behaviour..not in ADF but you can see it in all technologies, its the bahaviour of client side HTML and browser not the serverside code......
    when you click the button when partialSubmit disabled then browser does a full POSTBACK to server, and when you refresh page using F5 then the browser does perform the last action again.. it cannot be avoided untill and unless all operations are done by AJAX,
    Alternative to this one is you can set partialSubmit="true" to command component to avoid this behaviour.
    Regards,
    Santosh.

  • Calling page by h:commandButton action = ""

    i am new in jsf, and i calling a jsp page with action attribute of java server faces. But it doesn't work or not giving any error
    and one thing is its actionlistener atribute working properly
    any one can suggest me, wt should i do
    thanks

    hello ,
    U have given in navigation rule
    <from-outcome>success</from-outcome>
    but has to be trastered from actionlistener as sucsess.
    lemme give u my code ..
    JSP PAGE
    <h:commandButton action="#{testBean.stat}" value="Save">
    <f:actionListener type="jsfks.TestActionListener" />
    </h:commandButton>
    And in the bean :
    private String stat;
         public String stat(){
              return this.stat;
    //getter and setter methods
         public String getStat() {
              return stat;
    public void setStat(String string) {
              this.stat=string;
    And navigation-rule
    <navigation-rule>
              <from-view-id>/pages/Test.jsp</from-view-id>
              <navigation-case>
                   <from-action>#{testBean.stat}</from-action>
                   <from-outcome>success</from-outcome>
                   <to-view-id>/pages/greeting.jsp</to-view-id>
              </navigation-case>
              <navigation-case>
                   <from-action>#{testBean.stat}</from-action>
                   <from-outcome>failure</from-outcome>
                   <to-view-id>/pages/Test.jsp</to-view-id>
              </navigation-case>
         </navigation-rule>
    And in action listener :
    String stat;
    set stat to "success";
    code:
    testBean.setStat("success");
    Now it'll work.
    try it all the best.

  • JSF - commandbutton action firing commandlink action too

    Hi,
    I have a very weird problem. I googled on web and could not find anybody who faced this issue. Not sure if its my code.
    I have following commandlink with a datatable
    <h:commandLink id = "downloadfileid"
         value="#{usn.requeststatus}"
    action="#{DisplayExcelRequestsBean.downloadFile}" immediate="true">
         <f:param id="param1" name="filetoOpen" value="#{usn.requestfilename}"> </f:param>
    </h:commandLink>
    and a commandbutton on the page
    <h:commandButton id="refreshexcel"
    action="#{DisplayExcelRequestsBean.refreshExcelRequests}"
    value="< Refresh >" type="submit" >
    </h:commandButton>
    Both are making call to backing bean to do some action. The issue is when i click on commandlink, the downloadFile() method is executed which is good. But then after clicking on link, when i click on command button, the submit is first firing downloadFile() and then refreshExcelRequest(). Now why is it executing this other method first? I am newbie to jsf so maybe i am doing something wrong. But my understanding is that action should only fire what it is suppose to do.
    Anyhelp is appreciated.
    Thanks,

    Hi,
    Thanks for the responses. I am using JSF version 1.2
    Here is my code for both the methods downloadfile() & refreshExcelRequests(). The code is pretty straightforward.
    public void downloadFile() {
         FacesContext fc = FacesContext.getCurrentInstance();
         String pValue = this.getParam1().getValue().toString();
         File f = new File (pValue);
         HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse();
         response.setContentType("txt/plain");
         response.setHeader ("Content-Disposition", "attachment;filename=\""+ pValue +"\"");
         FileInputStream fis = null;
         OutputStream os = null;
           //     Load the file in the InputStream
             try {
                    fis = new FileInputStream(f);
                    os = response.getOutputStream();
                    int read = 0;
                    byte[] bytes = new byte[1024];
                    while((read = fis.read(bytes)) != -1){
                       os.write(bytes,0,read);
              os.flush();
              os.close();
              fc.responseComplete();
             } catch (Exception e) {
             return;
    public void refreshExcelRequests() {
             EventDownloadsDBManager edbm = new     EventDownloadsDBManager();
             this.setExcelreqlist( edbm.getEventDownloadRequestByNbkId(this.getLoggedinNBKID()) );
             return;            
    }

  • JSF action executed twice

    Hello all,
    sorry for my bad english.
    I've a simple form with only one <h:commandButton> who execute an action method.
    In this method i need to do a sleep of 60 seconds.
    The strange thing is that while waiting the 60 seconds, the action method is executed twice !
    This is my code:
    SimplePage.jsp
    <h:form id="simple_form">
      <h:commandButton id="ok_button" value="OK" action="#{bBean.doAction}" />
    </h:form>BackingBean.java
      public String doAction()
        try
          Thread.sleep(60000);
        catch (InterruptedException e)
          e.printStackTrace();
        return "ok";
       }Any help is appreciate.
    Carlo

    Hi Raymond,
    thanks for the reply.
    As you suggested , I've created a JSP page with only one form and submit button that fires an action who sleep for 60 seconds.
    In this case action is invoked only once.
    Any suggestion ?
    Thanks in advance
    Carlo

  • Update report dynamically? (without page refresh)

    I have a page with several regions, and only one region is visible at a time. Each region contains a report as well as a drop-down to alter the data displayed in the report. Currently each time a drop-down value is changed it submits the page, which causes the "main region" to become visible since it is set by default to display first.
    Is there a basic tutorial I can follow on how to dynamically update the report output without a page refresh?
    Thanks,
    Steve

    Steve wrote:
    I have a page with several regions, and only one region is visible at a time. Each region contains a report as well as a drop-down to alter the data displayed in the report. Currently each time a drop-down value is changed it submits the page, which causes the "main region" to become visible since it is set by default to display first.
    Is there a basic tutorial I can follow on how to dynamically update the report output without a page refresh?The easiest way to do this is using dynamic actions. Create a Refresh dynamic action for each region that executes when the associated select list is changed:
    h4. When
    Event: Change
    Selection Type: Item(s)
    Item(s): <select list associated with region>
    h4. True Action
    Action: Refresh
    Fire On Page Load: Yes or No depending on the requirements of your application
    Region: <region to be refreshed>
    Ensure that the value of the associated select list is submitted into session state before the refresh by specifying it in Page Items to Submit in the Source section of the report region definition.
    There are some dynamic action tutorials on the Oracle Learning Library. Doesn't specifically mention Refresh in the abstract, so it may not cover this specifically, but it is an introduction to dynamic actions in general.
    (It's probably possible to create a single dynamic action to handle refreshing all of the regions: we'd need more comprehensive details of your application, preferably reproducing it or a simplified version on apex.oracle.com.)

  • How to use one commandButton  to execute two task in JSF

    I have a form in JSF page which contains different faces components. These faces bind to ADF BC to insert one row in the database when the user press commandButton. Also I need to bind the value of one inputText in that form to managed bean to execute another task in the application when the user press the same commandButton.
    The code of the inputText:
    <h:inputText value="#{bindings.ProjectNumber.inputValue}"
    id="pn"
    size="10"
    required="#{bindings.ProjectNumber.mandatory}">
    The code of commandButton:
    <h:commandButton actionListener="#{bindings.Commit.execute}"
    value="Save"
    disabled="#{bindings.Commit.actionEnabled}"/>
    The managed bean is “findInspector”. I tried to insert inputHidden inside commandButton tag and assign the value of the inputText to the inputHidden as follows:
    <h:commandButton actionListener="#{bindings.Commit.execute}"
    value="Save"
    disabled="#{bindings.Commit.actionEnabled}">
    <h:inputHidden value="#{bindings.ProjectNumber.inputValue}" binding="#{findInspector.project}"/>
    </h:commandButton>
    But it was not work
    Please how can I write the code to use the value of the inputText more than one time in the JSF(one to insert one row by using ADF BC and another to use the same value to bind to a managed bean) and how to use one commandButton to execute two task in JSF.
    Thank you
    Waheed

    Yes I did
    <managed-bean>
    <description>The bean for get project No</description>
    <managed-bean-name>projectBean</managed-bean-name>
    <managed-bean-class>
    mcscm.model.ProjectBean
    </managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{bindings}</value>
    </managed-property>
    </managed-bean>
    Also I changed the method in the managed bean as follows:
    public String commandButton_action() {
    FacesContext fctx = FacesContext.getCurrentInstance();
    ValueBinding vb = fctx.getApplication().createValueBinding("#{bindings}");
    DCBindingContainer dcb = (DCBindingContainer) vb.getValue(fctx);
    OperationBinding operation = (OperationBinding) dcb.get("projectNumber");
    operation.execute();
    return null;
    where projectNumber is my method in the java class of the application module "TaskInformationImpl". I made this method to be accessed from outside of ADF BC.
    I just create a sample code for projectNumber method for testing only as:
    public void projectNumber (String data){
    System.out.print(data);
    In the page Pagedef file I added this :
    <methodAction id="projectNumber"
    InstanceName="TaskInformationDataControl.dataProvider"
    DataControl="TaskInformationDataControl"
    MethodName="projectNumber" RequiresUpdateModel="true"
    Action="999" IsViewObjectMethod="false">
    <NamedData NDName="data" NDValue = "#{bindings.ProjectNumber.inputValue}" NDType="java.lang.String"/>
    After I did all of this I get a new error like:
    javax.faces.FacesException: #{projectBean.commandButton_action}: javax.faces.el.EvaluationException: java.lang.ClassCastException: oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding cannot be cast to oracle.adf.model.OperationBinding
    Is it very difficult to do this in JDeveloper?. yes ADF BC provide me a lot of facilities, but when I want to do a specific task I face a lot of troubles

  • Javascript in 'Execute when page loads', not working when paging results grid

    I have some Javascript in an Apex page, running in 'Execute when page loads'. It does some stuff to a results grid. It works fine on page load, but then doesn't run when I page through, or sort the grid. I presume this is because the grid is being sorted / paged using Ajax, which means the page isn't being fully loaded.
    Is there anywhere else I can put the code so it gets applied to the grid on sorts and paging?

    Thanks, works perfectly! I used the After Refresh and just selected the region I wanted to trigger the Javascript, and it works great. As you say the scope needs to be Dynamic.
    For anyone else reading this, something which caught me out was that my reports region was using the No Template setting, and the Dynamic Action didn't work, as it requires you to use a template which contains #REGION_STATIC_ID# - which is used by the dynamic action to identify the region. Once I switched to using a template, it worked fine.

  • Partial page refresh is not working in APEX 4.0

    Hi All,
    I have a report region in my application,I have selected the following properties for the region,
    Pagination scheme - Row ranges X To Y (with next and previous links)
    Enable partial page refresh - yes
    Display position - bottom -right
    Their is an arrow mark link(next /previous) in the right bottom corner,when i click on that ,the region is displaying the next 15 rows, but the region is not getting refresh,the scroll bars are al went off if i click the previous/next link.
    After that i refreshed the page by clicking F5 ,scroll bar is appearing now.
    In the region header and footer i have added this code,
    <div style="overflow:auto;">
    </div>for scroll bar
    Please some body help me to fix this issue..
    Thanks & Regards,
    Ramya.
    Edited by: Ramya on Apr 15, 2012 10:42 PM

    Hi All,
    I fixed this issue.
    I used Skillbuilders modal popup plugin, to open the form page as popup when i edit the record.To implement this plugin i have already created dynamic action for edit ,create and autoclose the popup.
    In the dynamic action i changed the EVENT SCOPE from BINT To LIVE and tested the application.Now its working fine.
    I can able to edit the record after i hit the next/previous pagination link .
    Thanks ,
    Ramya.

  • Is it possible to intitate total page refresh from plugin code

    In 11.1.1.4 EMAIGC we are facing following issue: Target status is not getting refreshed after dependent components status change (Which will be done through through EM Plugin UI actions). This will status will be reflected only after manual refresh.
    From our plugin code , after the dependent component start/stop operations we wanted to call total page refresh, is there any way to handle this?
    Thanks ,
    Ramadevi

    In 11.1.1.4 EMAIGC we are facing following issue: Target status is not getting refreshed after dependent components status change (Which will be done through through EM Plugin UI actions). This will status will be reflected only after manual refresh.
    From our plugin code , after the dependent component start/stop operations we wanted to call total page refresh, is there any way to handle this?
    Thanks ,
    Ramadevi

  • (Classic) Report losing pagination on partial page refresh - APEX feature request

    I have a page with both an Interactive Report and some classic Report regions.
    Based on user updates, there are many occasions where I need to do a partial page refresh.
    Thanks to plugin http://www.apex-plugin.com/oracle-apex-plugins/dynamic-action-plugin/refresh-interactive-report-1.0_361.html
    I'm able to refresh my IR, but not my classic report (unless I do a submit of the whole page) without losing pagination.
    Request: Will a Dynamic action 'Refresh without losing pagination' be part of future apex versions?
    Now, in apex 4.2, is there another work around available for classic reports?
    (I use 'submit page' now as action, but it's at least a second slower as a partial refresh, and because I need it on every user update, this second becomes a big addition to user frustration).
    Thanks, JP

    Here is the solution for your problem:
    https://apex.oracle.com/pls/apex/f?p=31517:243
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    https://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494

  • How to use one commandButton to execute two tasks in JSF

    I have a form in JSF page which contains different faces components. These faces bind to ADF BC to insert one row in the database when the user press commandButton. Also I need to bind the value of one inputText in that form to managed bean to execute another task in the application when the user press the same commandButton.
    The code of the inputText:
    <h:inputText value="#{bindings.ProjectNumber.inputValue}"
    id="pn"
    size="10"
    required="#{bindings.ProjectNumber.mandatory}">
    The code of commandButton:
    <h:commandButton actionListener="#{bindings.Commit.execute}"
    value="Save"
    disabled="#{bindings.Commit.actionEnabled}"/>
    The managed bean is �findInspector�. I tried to insert inputHidden inside commandButton tag and assign the value of the inputText to the inputHidden as follows:
    <h:commandButton actionListener="#{bindings.Commit.execute}"
    value="Save"
    disabled="#{bindings.Commit.actionEnabled}">
    <h:inputHidden value="#{bindings.ProjectNumber.inputValue}" binding="#{findInspector.project}"/>
    </h:commandButton>
    But it was not work
    Please how can I write the code to use the value of the inputText more than one time in the JSF(one to insert one row by using ADF BC and another to use the same value to bind to a managed bean) and how to use one commandButton to execute two tasks in JSF.
    Thank you
    Waheed

    Just dopublic void execute() {
        anotherAction(inputValue);
    I guess those articles might be interesting about passing params and the usage of inputHidden and also about using datatables:
    http://balusc.xs4all.nl/srv/dev-jep-com.html
    http://balusc.xs4all.nl/srv/dev-jep-dat.html

  • Event handler when using partial page refresh ?

    Hi
    I have a calendar, which uses partial page refresh. The problem is how to make javascript wait until the calendar has loaded and then do some updates on the calendar (after the user has pressed the next button that runs apex.widget.calendar.ajax_calendar('S','next');, for example ). I thought I could add "onreadystatechange" (or onload) event handler to the calendar like this: onreadystatechange="checkState()", where the function would check the state and if ready then do the updates. This doesn't work. Could somebody please tell me why not ?
    Tiina

    Hi,
    It seems that ajax calendar missing event apexafterrefresh.
    I do not know is this "bug" or just feature.
    That event would be useful to your case , if I understand correct what you looking for.
    For workaround , you can over write original function by placing this to calendar region footer
    <script>
    apex.widget.calendar.ajax_calendar=function(p_calendar_type, p_calendar_action, p_calendar_date, p_calendar_end_date){
    var l_cal_type_field = $v('p_cal_type_field_id');
    var l_cal_date_field = $v('p_cal_date_field_id');
    var l_cal_end_date_field = $v('p_cal_end_date_field_id');
    var l_cal_id = $v('p_calendar_id');
    var l_calendar_region = 'calendar' + l_cal_id;
    if ( p_calendar_type != 'C' ){
      $s(l_cal_date_field,$v('p_calendar_date'));
    }else{
      if ( $v(l_cal_date_field) == '' ) {
       $s(l_cal_date_field,$v('p_calendar_date'));
      if ( $v(l_cal_end_date_field) == '' ) {
       $s(l_cal_end_date_field,$v('p_calendar_end_date'));
    // create and apex.ajax.widget object
    var a = new apex.ajax.widget('calendar',function(){
      /* start the return function */
      if(p.readyState == 1){
       document.body.style.cursor = "wait";
      }else if(p.readyState == 2){
      }else if(p.readyState == 3){
      }else if(p.readyState == 4){
       $x(l_calendar_region).innerHTML = p.responseText ;
       $s(l_cal_date_field,$v('p_calendar_date'));
       if (p_calendar_type == 'C') $s(l_cal_end_date_field,$v('p_calendar_end_date'));
       document.body.style.cursor = "";
      /* DO HERE THINGS AFTER CALENDAR REFRESH */
      }else{return false;}
    // code for next,previous and today
    if (p_calendar_type == 'S'){
      p_calendar_type = $v('p_calendar_type');
    }else{
      $s(l_cal_type_field,p_calendar_type);
    a.ajax.addParam('p_widget_mod',p_calendar_type);
    a.ajax.addParam('p_widget_action',p_calendar_action);
    a.ajax.addParam('x01',l_cal_id);
    var lDate = (!!p_calendar_date && p_calendar_date !== '')?p_calendar_date:$v(l_cal_date_field);
    if (p_calendar_type == 'C') {
      var lendDate = (!!p_calendar_end_date && p_calendar_end_date !== '')?p_calendar_end_date:$v(l_cal_end_date_field);
    a.ajax.add(l_cal_date_field,lDate);
    if (p_calendar_type == 'C') a.ajax.add(l_cal_end_date_field,lendDate);
    a.ajax.addParam('x02',lDate);
    if (p_calendar_type == 'C') a.ajax.addParam('x05',lendDate);
    a.ajax.add(l_cal_type_field,p_calendar_type);
    a._get();
    </script>Where I have comment *"do here things after calendar refresh"*, you can hook own scripts.
    Of course this is not best way, but might help you till ajax calendar support dynamic actions fully
    Regards,
    Jari
    Edited by: jarola on Oct 20, 2010 3:11 PM

  • CommandButton action method invoked multiple times in standalone OC4J

    Hi,
    We've developed an application in JDeveloper 10.1.3.3.0 (ADF Business Components version 10.1.3.41.57). In one page we have a commandButton with an action method:
    <af:commandButton action="#{MyBean.myActionMethod}"
    blocking="false"
    textAndAccessKey="#{nls['MY_LABEL']}"
    id="myButtonId" >
    <f:actionListener type="oracle.jheadstart.controller.jsf.listener.ResetBreadcrumbStackActionListener"/>
    </af:commandButton>
    This method is defined in a managed bean:
    public String myActionMethod() {
    /* some code */
    return "indexPage";
    There is a navigation-rule for outcome "indexPage". When we run our application in the JDeveloper embedded OC4J instance and click on the commandButton, the action method is invoked once and then the .jspx in the navigation-rule is navigated to.
    We deployed our application to a standalone OC4J instance. Both embedded and standalone OC4J have version: Oracle Containers for J2EE 10g (10.1.3.3.0) (build 070610.1800.23513)
    When we run our application in the standalone OC4J and click on the commandButton, the action method is repeatedly invoked in a seemingly infinite loop.
    We'd appreciate it if someone could shed some light on the matter. Please note that we cannot use <redirect /> in our navigation-rule for "indexPage" because in production we have an Oracle webcache server upstream of our OC4J. Users can only submit HTTPS requests to the webcache, which in turn forwards these requests as HTTP requests.
    Kind regards,
    Ibrahim

    Dear All,
    We'd really appreciate it if somebody would suggest some possible causes even if these might seem fare-fetched. Perhaps compare certain .jar files or something to that effect.
    Anything ????
    Thanks and regards,
    Ibrahim

Maybe you are looking for

  • View the anniversaries in iCal

    good morning.  How can I view the anniversaries in ical placed in contact? of course everything is synchronized (iPhone, iPad and iMac) with icloud

  • My MacBook Pro isn't updating to Lion

    I have bought and updated my Pro twice now with Lion but it never really 'updates'. I go through the entire process then my Mac goes to download Lion again. It's like an endless cycle with nohting changing. What's going on?

  • How to find out System Status of WBS Elements?

    Hi PS Experts! Please help me on my query. I want to get a list of WBS elements whose status is Released and can be used. If I try to search the table PRPS, it can only help me in finding WBS elements without deletion flag, with RA Key and so on. But

  • Urgent help needed on writing errors in to windows events application logs

    Hi all, we have web based application. Whenever there is critical errors encounters in our application we need to write that errors in to windows event viewer, application logs. Please help me on how to do this. do we have any specific API for this ?

  • What application should I set to open the Data_Viz Carbon Translator files?

    I was looking over the files in my AW application folder. Quite a few say (in Get Info) that they should be opened with a very old OS 9 game application I happen to have. And also the "Kind" is listed as a document for that same game. That's not righ