String concatenation in EL for dynamic ResourceBundle key

后端 未结 4 2069
终归单人心
终归单人心 2020-11-29 05:38

I have a resource bundle with entries like these:

entry1=value1
entry2=value2
entry3=value3

In my JSF page I\'m trying to use these keys dy

4条回答
  •  死守一世寂寞
    2020-11-29 05:47

    If you're already on Servlet 3.1 / EL 3.0 (Tomcat 8, WildFly 8, GlassFish 4, etc), make use of new EL 3.0 += operator:

    
    

    If you're only on Servlet 3.0 / EL 2.2 (Tomcat 7, JBoss AS 6/7, GlassFish 3, etc), make use of new EL 2.2 ability to directly invoke methods such as String#concat():

    
    

    If you're even not on Servlet 3.0 / EL 2.2 yet, make use of to create another variable with the desired EL expression inlined:

    
    
    

提交回复
热议问题