"inject managed-bean property into custom converter" Code Answer


in several case, when you need to inject a bean such as managedbean, ejb, etc. into a converter or a validator, you can try annotating your converter or validator as a managedbean. for example, you can try this:

public class myconverter implements converter {
    private mrejbbean mrejbbean;
    private mrsmanagedbean mrsmanagedbean;

    public object getasobject(facescontext context, uicomponent component, string value) {        
        // convert to object

    public string getasstring(facescontext context, uicomponent component, object value) {
        // convert to string


you can take a look at this for an example on validator.

By ximmyxiao on July 1 2022

Answers related to “inject managed-bean property into custom converter”

Only authorized users can answer the Search term. Please sign in first, or register a free account.