1

After having an instance of a Converter within a Managed Bean according to same issue as described in stackoverflow questions listed below, I am getting an exception that the object was not found.

Expression Error: Named Object: ch.foo.EnitityConverter@f163464 not found

Stackoverflow questions:

My xhtml code:

<h:selectManyCheckbox value="#{bean.selectedEmployees}">
  <f:converter converterId="#{bean.entityConverter}" />
  <f:selectItems value="#{bean.allEmployees}" var="e" itemLabel="#{e.name}" />    
</h:selectManyCheckbox>
Community
  • 1
  • 1
Thomas
  • 8,357
  • 15
  • 45
  • 81

2 Answers2

1

The converterId attribute expects the converter ID (the converter name). Any EL expression value is evaluated as a String. You're basically passing the toString() result of your converter instance to it, which is ch.foo.EnitityConverter@f163464. This converter ID is in turn not recognized as any of the registered converters. However .. You didn't want to pass the converter ID, but instead just reference a whole converter instance.

The converterId attribute is the wrong attribute whenever you want to reference a whole concrete instance instead. Use the binding attribute instead, or the input component's converter attribute.

Thus, so

<h:selectManyCheckbox value="#{bean.selectedEmployees}">
  <f:converter binding="#{bean.entityConverter}" />
  <f:selectItems value="#{bean.allEmployees}" var="e" itemLabel="#{e.name}" />    
</h:selectManyCheckbox>

or

<h:selectManyCheckbox value="#{bean.selectedEmployees}" converter="#{bean.entityConverter}">
  <f:selectItems value="#{bean.allEmployees}" var="e" itemLabel="#{e.name}" />    
</h:selectManyCheckbox>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
-2

It is missing converter name. Your name may be like entityConverter. Default will be calss name. Use as below;

   <f:converter converterId="#{entityConverter}" />
Zaw Than oo
  • 9,651
  • 13
  • 83
  • 131