java.io.NotSerializableException-org.omnifaces.taghandler.Converter [英] java.io.NotSerializableException - org.omnifaces.taghandler.Converter
问题描述
我有一个应用程序在Jboss 6上使用Primefaces 3.5和Omnifaces 1.5,并使用myfaces 2.1.5
I have an application using Primefaces 3.5 with Omnifaces 1.5 on Jboss 6, using myfaces 2.1.5
在尝试使用o:converter
时,出现以下错误.
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)
有关代码是...
<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>
推荐答案
我可以重现您的问题.这是MyFaces 2.1.5中的错误.我找不到相关的错误报告和修复版本,但至少可以告诉我,使用最新的MyFaces 2.1.12,此构造对我来说很好用.因此,升级MyFaces也应该为您完成.
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.
无关与具体问题无关,此处的转化策略有些奇怪.只需使用omnifaces.SelectItemsConverter
或omnifaces.SelectItemsIndexConverter
(如果您对Employee
实体没有很好的equals()
)就足够了.
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>
SelectItems(Index)Converter
严格不需要List<SelectItem>
作为模型,在视图中仅需要<f:selectItem(s)>
. List(Index)Converter
适用于不使用<f:selectItem(s)>
的组件,例如<p:autoComplete>
,<p:picklist>
等.
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.
如果您由于某些原因无法升级MyFaces,这将是替代解决方案.
This would be the alternate solution if you can't upgrade MyFaces for some reason.
这篇关于java.io.NotSerializableException-org.omnifaces.taghandler.Converter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!