Forum Stats

  • 3,873,344 Users
  • 2,266,537 Discussions
  • 7,911,514 Comments

Discussions

navigating to another page in a bean

2»

Answers

  • Ashish Awasthi
    Ashish Awasthi Oracle ACE Member Posts: 3,388 Bronze Crown
    edited May 20, 2016 7:03AM Answer ✓

    @mm07

    In your code I see a button (Good)

    and you have created an ActionEvent too (Good)

    1. RichCommandButton button = (RichCommandButton)root.findComponent("cb3"); 
    2.         
    3.         ActionEvent actinEvent = new ActionEvent(button); 

    But i don't see any code that queue this ActionEvent ??

    actionEvent.queue();


    Ashish

  • Sameh Nassar
    Sameh Nassar Member Posts: 1,076
    edited May 20, 2016 7:15AM

    Why you add commandButton with visible =false and invoke it from the code. You can use this code to navigate to the page from backbean

        FacesContext fc = FacesContext.getCurrentInstance();
        fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "<page-outcome>");
    

    In you case I expect something like this

      public void PswdValidator(ValueChangeEvent valueChangeEvent)
      {
        .
        .
        .
        oBindings.execute();
        oBindingsUsr.execute();
    
    
    
    
        Object o = oBindings.getResult();
        Object o1 = oBindingsUsr.getResult();
    
    
        if (o != null)
        {
          String msg = o.toString();
          FacesMessage fm = new FacesMessage(msg);
          throw new ValidatorException(fm);
        }
        
        if (o1.equals("open"))
        {
          FacesContext fc = FacesContext.getCurrentInstance();
          fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "<page-outcome>"); // write page outcome
          return;
        }
      }
    
  • Tony007
    Tony007 Member Posts: 4,285 Bronze Trophy
    edited May 20, 2016 9:53AM

    And where do I call my procedue and function I did add the queue I miss it when posting

    Tony007
  • Ashish Awasthi
    Ashish Awasthi Oracle ACE Member Posts: 3,388 Bronze Crown
    edited May 20, 2016 1:52PM

    If you have queued ActionEvent then it should work definitely

    @mm07

    You have got two different working solution for your problem , Now I don't understand where you are stuck

    For more reference and a sample Application you can check - Navigate to another page on value change event of ADF input component

    Ashish

  • Tony007
    Tony007 Member Posts: 4,285 Bronze Trophy
    edited May 23, 2016 1:56AM

    Ok what is page-outcome is the name of taskflow

  • Ashish Awasthi
    Ashish Awasthi Oracle ACE Member Posts: 3,388 Bronze Crown
    edited May 23, 2016 2:07AM

    It is the name of control-flow that you have used to navigate to another page

  • Tony007
    Tony007 Member Posts: 4,285 Bronze Trophy
    edited May 23, 2016 3:44AM

    ok i did this

    <af:inputText value="#{bindings.Password.inputValue}"
                            label="#{bindings.Password.hints.label}"
                            columns="#{bindings.Password.hints.displayWidth}"
                            maximumLength="#{bindings.Password.hints.precision}"
                            shortDesc="#{bindings.Password.hints.tooltip}" id="it3"
                            styleClass="inputTextRequired" required="true"
                            valueChangeListener="#{Pswdbean.PswdValidator1}"
                            autoSubmit="true">
                <f:validator binding="#{bindings.Password.validator}"/>
              </af:inputText>
    

      public void PswdValidator1(ValueChangeEvent valueChangeEvent) 
          { 
           
              OperationBinding oBindings = getOperationBinding("ExecUsrPswd");
              OperationBinding oBindingsUsr = getOperationBinding("getUsrStstus");
             
            oBindings.execute(); 
            oBindingsUsr.execute(); 
         
         
         
         
            Object o = oBindings.getResult(); 
            Object o1 = oBindingsUsr.getResult(); 
         
         
            if (o != null) 
            { 
              String msg = o.toString(); 
              FacesMessage fm = new FacesMessage(msg); 
              throw new ValidatorException(fm); 
            } 
             
            if (o1.equals("EXPIRED")) 
            { 
              FacesContext fc = FacesContext.getCurrentInstance(); 
              fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "ResertUserPswdTaskFlow"); 
              return; 
            } 
          } 
    

    but am geting this error msg when i navigate out of my inputtext instead dof error msg in my procedure

    errormsg.PNG

  • Ashish Awasthi
    Ashish Awasthi Oracle ACE Member Posts: 3,388 Bronze Crown
    edited May 23, 2016 4:19AM

    ResertUserPswdTaskFlow is the name of contrlFlow or taskFlow ?

    You have to provide controlFlow name, Not taskFlow

    navigateIT1.jpg

    See this image as per this you have provide "goToPage2" as parameter to navigate to Page2

    Have you not checked the link i mentioned ?

    Again look at- Navigate to another page on value change event of ADF input component

    Ashish

This discussion has been closed.