JSP: accessing enum inside JSP EL tags

Posted by Arjun on Stack Overflow See other posts from Stack Overflow or by Arjun
Published on 2011-03-03T15:23:05Z Indexed on 2011/03/03 15:24 UTC
Read the original article Hit count: 297

Filed under:

My java enum looks like this:

public enum EmailType { HOME, WORK, MOBILE, CUSTOMER_SERVICE, OTHER }

In JSP, I am trying to do sth like below, which is not working.

<c:choose>
          <c:when test="${email.type == EmailType.HOME}">(Home)</c:when>
          <c:when test="${email.type == EmailType.WORK}">(Work)</c:when>
</c:choose>

After googling, I found these links: Enum inside a JSP. But, I want to avoid using scriplets in my JSP. How can I access the java enum inside EL tag and do the comparision?? Please help.

© Stack Overflow or respective owner

Related posts about jsp