问题
I wrote my first JSF (1.2) custom converter.
I declared it in faces-config.xml (converter-id
and converter-class
), wrote the Java class implementing getAsObject and getAsString methods.
Then i put the converter in a page like this:
<ice:selectInputDate id="ctldatanascita"
value="#{beanrichiestaabilitazione.datanascita}"
renderAsPopup="true">
<f:converter converterId="cisConverterDate" />
</ice:selectInputDate>
The class is istantiated, but the Converter interface methods are never called. What I'm missing?
回答1:
I don't do IceFaces, so I can't tell from top of head if that is normal. But Googling on "ice:selectinputdate converter" leads me to this topic as first hit: http://www.icefaces.org/JForum/posts/list/6163.page which confirms the behaviour you're seeing.
It als mentions several prerequirements and solutions:
- You need at least ICEfaces 1.7 DR2 or ICEfaces 1.6.2.
- Your converter needs to extend javax.faces.convert.DateTimeConverter.
- Or just use standard <f:convertDateTime> instead.
来源:https://stackoverflow.com/questions/5515193/my-first-custom-converter-whys-not-called