4 Replies Latest reply on Jan 18, 2010 12:14 AM by jsfgeeks

    equivalent of jsf prerender method in richfaces

    jsfgeeks

      hi,

      i am migrating my jsf visual web project to richfaces.

      my requirement is that i want to use equivalent of jsf prerender method?

      is any method available?

      thanks!

        • 1. Re: equivalent of jsf prerender method in richfaces
          ilya_shaikovsky
          Please provide some links to documentation of visual web project and prerender to be sure we are on the same page.
          • 2. Re: equivalent of jsf prerender method in richfaces
            jsfgeeks

            hi, thank you very much for your reply actually i converted following page in richfaces.in below find prerender method with @override which overrides method of superclass AbstractPageBean.this superclass available only in jsf web ui framework not in richfacres.it's import is "import com.sun.rave.web.ui.appbase.AbstractPageBean;" i have tried with javax.annotation & javax.persistence.PrePersist.

            but nothing working fine!

            any help would appreciated!!!!!

             

            public class uright_general extends AbstractPageBean
            {
                //variables for counter purpose for different checkbox array
                boolean check_del = false;
                FacesContext fc = FacesContext.getCurrentInstance();

                public uright_general()
                {

             

            populate_usertype_listbox();
                    check_usertype();
                    current_locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();

             

                    //alert1.setVisible(false);
                    //  System.out.println(usertype_listbox.getSelected());
                    if (edit_level1)
                    {
                        btn_update.setRendered(true);
                    }
                    else
                    {
                        btn_update.setRendered(false);
                    }
                    if (delete_level1)
                    {
                        btn_delete.setRendered(true);
                    }
                    else
                    {
                        btn_delete.setRendered(false);
                    }
                    if (usertype_listbox.getValue() != null && usertype_listbox.getValue().toString().length() > 0)
                    {
                        user_type = usertype_listbox.getValue().toString();
                        populate_default_right_table();
                    }
                    else if (session.getAttribute("u_type") != null)
                    {
                        usertype_listbox.setValue(session.getAttribute("u_type").toString());
                        usertype_listbox.setValue(session.getAttribute("u_type").toString());
                        user_type = session.getAttribute("u_type").toString();

             

                        populate_default_right_table();
                    }
                    else
                    {
                        user_type = "Guest";
                        System.out.println(usertype_listbox.getValue());
                        usertype_listbox.setValue(user_type);
                        populate_default_right_table();
                        usertype_listbox.setValue(user_type);
                    }

             

                }
            @Override
                public void prerender()
                {
                  System.out.println("from prerender it");
                    if (!check_del)
                    {
                        if (usertype_listbox.getValue() != null && usertype_listbox.getValue().toString().length() > 0)
                        {
                            //   user_type = usertype_listbox.getSelected().toString();
                            usertype_listbox.setValue(user_type);
                            populate_default_right_table();
                        }
                        else if (session.getAttribute("u_type") != null)
                        {
                            usertype_listbox.setValue(session.getAttribute("u_type").toString());
                            //    usertype_listbox.setSelected(session.getAttribute("u_type").toString());
                            user_type = session.getAttribute("u_type").toString();

             

                            populate_default_right_table();
                        }
                        else
                        {
                            user_type = "Guest";

             

                            System.out.println(usertype_listbox.getValue());
                            usertype_listbox.setValue(user_type);

             

                            usertype_listbox.setValue(user_type);
                            populate_default_right_table();
                        }
                    }

            }

            • 3. Re: equivalent of jsf prerender method in richfaces
              nbelaevski

              Hi,

               

              This prerender method is a part of WebUI extension to JSF, not JSF itself. You can implement PhaseListener interface to be notified of RENDER_RESPONSE JSF lifecycle phase.

              • 4. Re: equivalent of jsf prerender method in richfaces
                jsfgeeks

                hi, thanks

                       And sorry for late reply can u please tell me  how will i use pahselistner. i have used it with f:view tag afterphase listner like below

                 

                 

                <f:view locale="#{skinBean.currentlocale}"  afterPhase="#{uright_general.prerender}">

                but some time it's sub method returns null pointer exception and second thing it will execute after every pahse of jsf lofecycle except render response.

                is it rightway?