Passing a Enum value as a parameter from JSF

前端 未结 2 1149
不思量自难忘°
不思量自难忘° 2020-12-14 02:39

I am trying to migrate my existing code to using Enum and I run into some problems due to my lack experience with Enum. First of all here is my structures. In my EJB

相关标签:
2条回答
  • 2020-12-14 03:12

    You can't access enums like that in EL. JSF has however builtin enum converters for EL. You can just use the enum name as string.

    <h:commandButton value="Test" action="#{myBean.Test('PROFILE_COMMENT')}" />
    
    0 讨论(0)
  • 2020-12-14 03:18

    In my case that helped me.

    Simple compare enum to its value. EL recognize it and also check if that value exists while validating xhtml.

    <c:if test="#{requestManager.selectedRequestType == 'ItemCreate' or requestManager.selectedRequestType == 'ItemChange'}"></c:if>
    
    0 讨论(0)
提交回复
热议问题