I have a custom converter for selecting a country in the SelectOneMenu component:
File: address.jar
@FacesConverter(value="CountryConverter", forClass=Country.class)
public class CountryConverter implements Converter {
private CountryBean countryBean = CountryBean.getCountryService();
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
return countryBean.find(value);
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value != null)
return ((Country)value).getcc_fips();
else
return null;
}
And this is the xhtml text:
File: project root
<h:selectOneMenu id="country" value="#{cc.attrs.addrEntity.country}">
<f:selectItem itemLabel="Please select one..."
noSelectionOption="true" />
<f:selectItems value="#{cc.attrs.addrBean.countries}"
var="model"
itemLabel="#{model.name}"
itemValue="#{model}"
noSelectionValue="“no selection”"/>
<f:converter ConverterId="CountryConverter"/>
</h:selectOneMenu>
I have a converter in the file " address.jar ", and when I try to open the page for writing the address, then it replies: "Expression error: an object named MyCustomCoverter was not found." . Even when I copy the converter to the project where the xhtml files are located, it works fine. What can I do to solve this problem?
Why does this not work from a separate jar file?
Thank.
source
share