Hello all,

i have trouble to get a dataTable with dataScroller to work.

I have a ManagedBean wich get a result from search in database.

code:

public class SearchBean {
        
        List result;

        public void validateSearch(FacesContext context,
                        UIComponent componentToValidate, Object value)
                        throws ValidatorException {
                
                
                result = SearchDAO.findByName(value.toString());

                if(result.isEmpty()){
                        FacesMessage message = new FacesMessage(
                                        "No result found with name " +
value.toString()+ "!");
                        throw new ValidatorException(message);
                }
        }

        public List getResult() {
                return this.result;
        }
}

If i configure the the bean in request scope, the 1. page looks
fine (rows 1-10 from e.g. 30), but if paginate or forward to the 
next page, result is empty.

I found out this is normal behaviour with JSF and request scope, so no
matter
and i changed the scope to session. With that configured everything
works well.

But on http://wiki.apache.org/myfaces/FAQ i found the follwing info:

"t:saveState is preffered over a session scoped solution."

As well i don`t need the whole result the whole session in memory.

What i did now is:
added <t:saveState id="searchresult" value="#{searchbean.result}" /> in
result.jsp 
added "implements Serializable" to SearchBean and 
set scope back to "request". 

But now i get the exception:

62001 [http-8080-Processor24] ERROR
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTableRendererBase
- Row is not available. Rowindex = 0
65135 [http-8080-Processor24] ERROR
org.apache.myfaces.lifecycle.PhaseListenerManager  - Exception in
PhaseListener RESTORE_VIEW(1) afterPhase
java.lang.NullPointerException
        at
org.apache.myfaces.renderkit.html.util.AutoScrollPhaseListener.afterPhas
e(AutoScrollPhaseListener.java:52)

...
javax.faces.el.PropertyNotFoundException: Bean:
com.jmangos.beans.SearchBean, property: result
        at
org.apache.myfaces.el.PropertyResolverImpl.setProperty(PropertyResolverI
mpl.java:391)


What did next was to wrap result in ListDataModel, but the i get
java.io.NotSerializeableException: ListDataModel.

Does anybody know a good tutorial, on how to work with dataTable and
dataScroller on request scoped beans?

How can i use saveState on result?


Regards Oliver





Reply via email to