Question

I have an application using Primefaces 3.5 with Omnifaces 1.5 on Jboss 6, using myfaces 2.1.5

on trying to use the o:converter I am getting the follow error.

org.omnifaces.taghandler.Converter

viewId=/xhtml/propelModules/initiatePropel.xhtml
location=C:\jboss-6.1.0.Final\server\default\deploy\PropelEAR.ear\PropelWeb.war\xhtml\propelModules\initiatePropel.xhtml
phaseId=RENDER_RESPONSE(6)

Caused by:
java.io.NotSerializableException - org.omnifaces.taghandler.Converter
at java.io.ObjectOutputStream.writeObject0(Unknown Source)

The code concerned is ...

<p:selectManyCheckbox value="#{initiatePropelManagedBean.currentWon.selectedEmployeeList}" 
  layout="pageDirection">
<o:converter converterId="omnifaces.ListIndexConverter" 
      list="#{initiatePropelManagedBean.currentWon.employeeList}" />
     <f:selectItems value="#{initiatePropelManagedBean.currentWon.employeeList}"
       var="emp" itemLabel="#{emp}" itemValue="#{emp}" />
     <p:ajax process="@this" update="employeeCount"></p:ajax>
</p:selectManyCheckbox>
Était-ce utile?

La solution

I can reproduce your problem. This is a bug in MyFaces 2.1.5. I can't find the associated bug report and the fix version, but I can at least tell that this construct works just fine for me with the current latest MyFaces 2.1.12. So, upgrading MyFaces should do it for you as well.


Unrelated to the concrete problem, the conversion strategy is here somewhat strange. Just using the omnifaces.SelectItemsConverter or omnifaces.SelectItemsIndexConverter (if you don't have a good equals() on the Employee entity) should be sufficient.

<p:selectManyCheckbox ... converter="omnifaces.SelectItemsIndexConverter">
    <f:selectItems value="#{initiatePropelManagedBean.currentWon.employeeList}" />
</p:selectManyCheckbox>

The SelectItems(Index)Converter doesn't strictly require a List<SelectItem> as model, it only requires a <f:selectItem(s)> in the view. The List(Index)Converter is intented for components which do not use <f:selectItem(s)>, such as <p:autoComplete>, <p:picklist>, etc.

This would be the alternate solution if you can't upgrade MyFaces for some reason.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top