14 Replies Latest reply: Aug 1, 2012 10:13 AM by Maxime Carrier RSS

    Page didn't refresh after execution of Java code

    Maxime Carrier
      Hi all,

      I am mixing DataBase, Java, ADF and WebCenter in one project. I want to have a label that appears when I make a modification, stays for 5 seconds and then, disappears. I have this code that works well for the modification label:

      public void buttonSaveClick(ActionEvent actionEvent) {
      ADFUtil.invokeEL("#{bindings.Commit.execute}",
      new Class[] { ActionEvent.class },
      new Object[] { actionEvent });
      System.out.println("trewq");
      String textEmployee =
      changesEmployee.getValue().toString() + nameEmployee.getValue().toString() +
      ".";
      changesEmployee.setValue(textEmployee);
      changesEmployee.setVisible(true);
      AdfFacesContext.getCurrentInstance().addPartialTarget(changesEmployee);
      timer = new Timer();
      timer.schedule(new Modification(), 5000);
      }

      class Modification extends TimerTask {
      public void run() {
      System.out.println("asdf");
      changesEmployee.setVisible(false);
      AdfFacesContext.getCurrentInstance().addPartialTarget(changesEmployee);
      System.exit(0);
      }
      }
      }

      Quickly explained, when a click occurs on the save button, the label appears saying a modification happened on the employee X (name from a database) stays there for five seconds, but it doesn't disappear like it should be. Strangely, my System.out.println("asdf"); occurs five seconds after the click, so it's not a timer problem... The partialTarget works well on the setVisible(true) but not on the setVisible(false).

      changesEmployee is a label attribute from a binding in a jspx page (af:outputLabel).

      Thanks for your help :)