Descripción de enumeración en JSP

I have a Enum with Key and description like below. In JSP I will be getting the value and I want to display the description.

public enum STATUS {
    ACTIVE("A", "Active"),

private final String value;
    private final String description;

    public String getValue() {
        return value;
    public String getDescription() {
        return description;
    STATUS(String value, String description) {
        this.description = description;

    public static STATUS fromValue(String value) {
        if (value != null) {
            for (STATUS status : values()) {
                if (status.value.equals(value)) {
                    return status;
        return getDefault();

preguntado el 24 de agosto de 12 a las 21:08

Define precisely "¿Cómo proceder con esto?"-

What exactly do you mean by "getting the value"? -

1 Respuestas

As you've there a valid Javabean-compliant getter method, you can just access it the usual Javabean way.


Or if it's referenced as a property of una alternativa, javabean, then do so


Respondido 24 ago 12, 21:08

I will get the value as "A" from other object (Aobj) and STATUS enum is other object, I don't have any reference of STATUS in the object (Aobj). - changeme

Por qué tienes un String "A" en lugar de Status ACTIVE en tu Aobj? You've got some design mistakes there. Just replace that String by Status and this problem will disappear and everything else will instantly become so much easier. - BalusC

I surely agree, after you said it is design issue, then I corrected myself and could able to get the description. - changeme

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.