[jboss-user] [JBoss Seam] - Enum in Seam

rbcdexia do-not-reply at jboss.com
Thu Jun 28 08:44:23 EDT 2007


I have this factory to show the enum values in my seam application:

@Factory("tiposPoder")
  |    public TipoPoder[] getTipoPoder() {
  |       return TipoPoder.values();
  |    }

This is the code of my enum:
public enum TipoPoder implements Serializable {
  | 
  |     MANCOMUNADO("M")
  | 	, SOLIDARIO("S");
  |     private String value;
  |     	private TipoPoder(String value){
  | 	    this.value = value;
  | 	}
  | 	public String getValue(){
  |         	return value;
  | 	}
  |     	public static TipoPoder fromValue(String s){
  | 		for (TipoPoder obj : TipoPoder.values())
  | 		{
  | 			if (obj.getValue().equals(s))
  | 				return obj;
  | 		}
  | 		return null;
  | 	}
  | }

Then in my xhtml page I refer to this using the following code:
<s:decorate template="layout/display.xhtml">
  | 			<ui:define name="label">Tipo</ui:define>
  |                         <h:selectOneMenu value="#{apoderadoList.apoderado.tipo}">
  |                             <s:selectItems value="#{tiposPoder}" var="tiposPoder" label="#{tiposPoder.value}" />
  |                             <s:convertEnum/>
  |                         </h:selectOneMenu>
  |                     </s:decorate>
  | 

I recived the following exception in my application:
javax.faces.el.EvaluationException: /ApoderadoList.xhtml @75,62 rendered="#{empty apoderadoList.resultList}": Exception getting value of property resultList of base of type : action.SeamApplication1.model.ApoderadoList_$$_javassist_144
  | 
  | 
  | Caused by: java.lang.IllegalArgumentException: Unknown name value for enum class action.SeamApplication1.action.enums.TipoPoder: S
  | 
  | 

Can you help me?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058709#4058709

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058709



More information about the jboss-user mailing list