2

我有一个在 Jboss 6 上使用 Primefaces 3.5 和 Omnifaces 1.5 的应用程序,使用 myfaces 2.1.5

在尝试使用时,o:converter我收到以下错误。

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)

有关的代码是...

<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>
4

1 回答 1

3

我可以重现你的问题。这是 MyFaces 2.1.5 中的一个错误。我找不到相关的错误报告和修复版本,但我至少可以告诉我,这个结构在当前最新的 MyFaces 2.1.12 中工作得很好。因此,升级 MyFaces 也应该为您完成。


与具体问题无关,这里的转换策略有些奇怪。仅使用omnifaces.SelectItemsConverteror (如果您对实体omnifaces.SelectItemsIndexConverter没有好处)就足够了。equals()Employee

<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.

于 2013-09-10T11:23:05.597 回答