Java examples for javax.faces.context:FacesContext
The following code shows how to get Text.
import java.util.ResourceBundle; import javax.faces.context.FacesContext; public class Main{ public static String getText(Enum e) { FacesContext context = FacesContext.getCurrentInstance(); ResourceBundle bundle = context.getApplication().getResourceBundle( context, "texts"); return bundle.getString(e.getClass().getSimpleName().toLowerCase() + e.name().toUpperCase()); }//w ww .j ava 2s . co m }