1 Reply Latest reply on Nov 11, 2009 6:40 AM by ilya_shaikovsky

    Richfaces  and jsf bean questions

      The Setup

      I've recently started developing in jsf and richfaces for the firs time two weeks ago. Also this is my first project using beans. I am trying to implement a search page using server-side pagination, sorting, and filtering.

      I have the server-side pagination working using the rich:dataTable, rich:datascroller and my pagination bean which extends the serializableDataModel. This section works fine, I can manipulate the call to the db and only get back the rows I want.

      The next portion of this is sorting. I have that working now using an a4j commandLink which sets my sort field on my session bean and it also determines if it is ascending or descending.

      Great almost there....

      The last portion is filtering and this is where my problem is.

      What I'm trying to do

      I'm trying to have about 6 (or more) inputText fields that the user can enter data into. From there they will click a "search" button which is an a4j commandButton and that will have an action which will construct the where clause of the query and then save it to the criteria field on the pagination session bean.

      My first question is, if you were implementing this how would you do it?

      I've tried the following and I'm starting to go crazy...

      I tried creating a request scope backing bean that will get all the parameters from the page and then the commandButton action will call filterBean.buildQuery which sets the Query field on the filter request bean. But now I have no idea how to get filterBean.query to be set on my pagination session bean. Can this be done? If so, how? Maybe an example if you got one handy.


      My second attempt I created a a4j:commandButton which called an action paginationBean.buildQuery and I wanted to grab the inputText values that the user entered from the facesContext.getCurrentInstance() but i wasnt sure how to and everything I tried returned null. How can I do it this way?

      Thanks any help would appreciated.

      ~Oli