get Bundle for Java Server Face - Java javax.faces.context

Java examples for javax.faces.context:FacesContext

Description

get Bundle for Java Server Face

Demo Code


import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class Main{
    public static void main(String[] argv) throws Exception{
        System.out.println(getBundle());
    }/*from  w  w  w.j av a2s.c  o m*/
    private static ResourceBundle bundle;
    private static ResourceBundle getBundle() {
        if (bundle == null) {
            FacesContext context = FacesContext.getCurrentInstance();
            bundle = context.getApplication().getResourceBundle(context,
                    "msgs");
        }
        return bundle;
    }
}

Related Tutorials