2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

how to use JSF @FacesConverter in jsf?

how to use JSF @FacesConverter in jsf?
userimage

The @FacesConverter is by default not eligible for dependency injection by @Inject nor @EJB. There is a workaround for EJB, but this is nasty and doesn't work out for CDI. Another way would be to make it a JSF or CDI managed bean, however this doesn't register the converter instance into the JSF application context, and hence you won't be able to make use of Application.createConverter(String) on it. Further it also breaks the power of forClass attribute, i.e. you can't register a JSF converter for a specific type anymore and you'd need to explicitly declare it everytime.


Have a look into http://www.laliluna.com/articles/posts/javaserver-faces-converter-tutorial.html to find out more effective use of @FacesConverter with verities of examples.

Answer is