Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
Type Ahead server-side filtering example (Exception thrown : java.io.NotSerializableException: javax.faces.model.ListDataModel)
posted

 

I've been noticing java.io.NotSerializableException: javax.faces.model.ListDataModel

Exceptions in your ServerSideFilteringPageBean example.

Looks like javax.faces.model.ListDataModel doesn't implement

 

 

java.io.Serializable

. Do have an alternative suggestion?

The exception occurs when you have client specified as the param-value in your web.xml file.

<context-param>

<description>

The location where state information is saved.

Valid values are 'server' (typically saved in HttpSession) and 'client' (typically

saved as a hidden field in the form.

Default is server.</description>

<param-name>javax.faces.STATE_SAVING_METHOD</param-name>

<param-value>client</param-value>

</context-param>

<context-param>

 

In the Backing Bean:

 public void onItemsRequested(ItemsRequestedEvent event)
 {
  
  HtmlDropDown dropDown = (HtmlDropDown)event.getComponent();
  String cv = (String) dropDown.getCurrentValue();
  
  System.out.println("Updating for "  + cv);
  
  ArrayList ees = employees.getEmployees(cv);
  List newItems = new ArrayList();
  HtmlDropDownItem item;
  for(int i=0;i<ees.size();i++) {
   item = new HtmlDropDownItem();
   item.setText((String)ees.get(i));
   newItems.add(item);
  }  
  DataModel filteredModel = new ListDataModel(newItems);
  dropDown.getItems().clear();
  dropDown.setDataSource(filteredModel);
 }

 

 

 

 

Parents
No Data
Reply
  • 19693
    posted

    Hello Ron,

    I took a look at the source code that you have applied in the post and

    I  saw that you are working on our online samples.

    I made the sample too and I am applying the source code in the attached *.zip file.

    I run the sample but I didn't saw any thrown exceptions.

    Please take a look at it and tell me what else  I have to add to the sample to reproduce your case.

    Thank you

    ClientSideFiltering.zip
Children
No Data