Announcement Announcement Module
Collapse
No announcement yet.
I18n (locale) for Enums Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • I18n (locale) for Enums

    Hi together,
    I'm trying to bind enum values to my jsf-spring app. I searched the web but I can't find a way to i18n my values.

    Here my code:
    Code:
    package de.hr.ec.hai.web.util;
    
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
    
    import javax.faces.model.SelectItem;
    
    import org.springframework.stereotype.Service;
    
    import de.hr.ec.hai.ejb.entity.ActionTypeCategory;
    
    @Service
    public class ReferenceData implements Serializable {
    
    	private static final long serialVersionUID = -5008208613647249022L;
    	private List<SelectItem> actionTypeCategories;
    
    	public List<SelectItem> getActionTypeCategories() {
    		if (actionTypeCategories == null) {
    			actionTypeCategories = new ArrayList<SelectItem>();
    			for (ActionTypeCategory category : ActionTypeCategory.values()) {
    				actionTypeCategories.add(new SelectItem(category, category.name()));
    			}
    
    		}
    		return actionTypeCategories;
    	}
    
    }
    Code:
    						<h:selectOneRadio id="category" required="true" value="#{actionType.category}" layout="pageDirection">
      							<f:selectItems 
      								value="#{referenceData.actionTypeCategories}"
                    			/>
      						</h:selectOneRadio>
    Any idea how to use my ressource bundle in the view?
Working...
X