myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walter Oliver (BR/ICI3)" <>
Subject dataScroller, ListDataModel and saveState
Date Tue, 15 May 2007 09:29:25 GMT
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.


public class SearchBean {
	List result;

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

			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
and i changed the scope to session. With that configured everything
works well.

But on 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
added "implements Serializable" to SearchBean and 
set scope back to "request". 

But now i get the exception:

62001 [http-8080-Processor24] ERROR
- Row is not available. Rowindex = 0
65135 [http-8080-Processor24] ERROR
org.apache.myfaces.lifecycle.PhaseListenerManager  - Exception in
PhaseListener RESTORE_VIEW(1) afterPhase

javax.faces.el.PropertyNotFoundException: Bean:
com.jmangos.beans.SearchBean, property: result

What did next was to wrap result in ListDataModel, but the i get 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

View raw message