6 Replies Latest reply: Aug 23, 2013 3:14 PM by Timo Hahn RSS

    best practices with managed bean

    sebastiancali

      Hi, I have 7 jsf which have 4 listaschoice and checkbox all use the same.

      the difference is that when running the action of the button, going to run a different, now I have one for the 7 jsf bean and the only thing that changed is the method of action of the button, which I recommend, I say use every jsf by bean

        • 1. Re: best practices with managed bean
          Timo Hahn

          User, please tell us your jdev version.

           

          I don't think I fully understand what you are trying to do.

           

          You have 7 jsf (fragment) views. Each shows 4 selectOneChoice and one checkbox. The selectOneChoice and the checkbox are always showing the same data and are based on the same data. There exist a button (not sure if the button is part of each of the jsf views or not) which should call an action which differs for each jsf view.

           

          Is this correct?

          Where is the button located? What action does the button call?

           

          Timo

          • 2. Re: best practices with managed bean
            sebastiancali

            yes, my versión Version 11.1.2.3.0

            I have 7 jsf equal, each has a button, which is ajecuta an action that executes a process pl / sql different, then I have one just for the 7 jsf bean, and that bean I have in seven methods, each is named according to jsf availing action.

            my question is whether 7 jsf using the same that is in the bean in this case is 4 lists and 4 fields that I check with arraylist all are visually similar, just change the method of the button, which I should do, I apologize for my writing English, what happens is that I am Latin American

            • 3. Re: best practices with managed bean
              Timo Hahn

              Best practice is that each jsf page has it's own bean. However, you can use one base bean which holds all the common stuff and extend it for the special use in each of the page.

               

              Timo

              • 4. Re: best practices with managed bean
                sebastiancali

                thanks,

                another question, you have experience in adf, I wonder if this framework has the ability to run processes pl/sql,

                as this I'm doing everything with button actions, and execute the method that executes the process, for example:

                 

                    public String buttonfagepr() { //Generacion de procesos(detalles) fagepr.jsf
                        String vaProceso = "Generacion de procesos";
                        String vaProcedimiento = "ARQU.mbfacturacion.fnuProcFact";
                        String vaTipo = "S";
                        String modulo = "FA";
                        String[] datosGenXML = new String[2];
                        //"IdParametro", "TipoParam", "TipoDato", "Order", "Value"
                        //System.out.println(this.periodo);
                        datosGenXML[0] = "c#,#IN#,#NUMBER#,#1#,#" + super.getPeriodo();
                        datosGenXML[1] = "mensajeError#,#OUT#,#VARCHAR2#,#2#,# ";

                        ArqUtils.procedures(vaProceso, vaProcedimiento, vaTipo, modulo, datosGenXML);
                        return null;
                    }

                 

                I want to know if the framework has the option of running processes pl / sql ...thanks timo

                • 5. Re: best practices with managed bean
                  sebastiancali

                  the method ArqUtils.procedures is running the process certainly is a bean that I use to send all such methods

                  • 6. Re: best practices with managed bean
                    Timo Hahn

                    Well, use you can run pl/sql procedures, but the question is why?

                    ADF is not forms. They are different.

                    If you like to keep your logic in pl/sql then apex might be a better choice.

                    Adf is more for modern web based applications. You don't have dedicated connections which are needed for most pl/sql based logic.

                     

                    Next thing is that you should not call pl/sql directly from a bean as this is a part which belongs to the model layer in a MVC architecture. Do if you call pl/sql you create a method on the application module, expose this method to the client interface and call this method from the bean.

                    Samples can be found here http://adfpractice-fedor.blogspot.de/2013/01/working-with-plsql-procedures-in-adf-bc.html and http://www.baigzeeshan.com/2010/05/calling-plsql-procedure-and-function-in.html

                     

                    Timo