Access Enum value using EL with JSTL

前端 未结 13 2002
迷失自我
迷失自我 2020-11-29 00:18

I have an Enum called Status defined as such:

public enum Status { 

    VALID(\"valid\"), OLD(\"old\");

    private final String val;

    Status(String va         


        
13条回答
  •  日久生厌
    2020-11-29 00:28

    When using a MVC framework I put the following in my controller.

    request.setAttribute(RequestParameterNamesEnum.INBOX_ACTION.name(), RequestParameterNamesEnum.INBOX_ACTION.name());
    

    This allows me to use the following in my JSP Page.

    
    

    It can also be used in your comparison

    
    

    Which I prefer over putting in a string literal.

提交回复
热议问题