tags:

views:

32

answers:

1

I am using JSF 1.1 on WebSphere 6.1. I am building search functionality within an application and am having some issues. I've stripped out the extras, and have left myself with the following:

4 managed beans:

  • SearchController - Controller bean, session scope
  • SearchResults - session scope (store the results)
  • ProductSearch - session scope (store the search conditions)
  • ResultsBacking - Backing bean for DataTable, used to determine which row was clicked, request scope

The SearchController bean has, as managed properties, the other 3. All except ResultsBacking are session scoped.

If there is only 1 item in the search results, I want to bring up that record directly. I call setFirst(0) for the data table in the ResultsBacking method (I want to use the existing method that handle which item was clicked, so this is called right after the setFirst).

When I go to do another search, I get an IllegalArgumentException when calling getRowData in the data table. According to the api, this is thrown 'if now(sic) row data is available at the currently specified row index'.

I'm confused as to why this happens. It works the first time but not the second. Do I need to remove the ResultsBacking on a new search to get rid of the old state?

A: 

In the getFirstRow method in my backing bean, I was call setFirst(0) on the databable. Changing this to setRowIndex(0) fixes the problem.

Sean