sidkool3k
sidkool3k

Reputation: 43

How to compare an EL expression against the result of another EL expression

I have following attribute in my Facelet:

rendered="#{createTicketBaseBean.show == '#{I18N['key_please_select']}'}"

I am trying to compare the value with property in my properties file, but I get following error:

Error Parsing: #{createTicketBaseBean.show == '#{I18N['key_value_incident']}'}`

But when I replace the above expression with a hard coded value like below:

rendered="#{createTicketBaseBean.show == 'incident'}"

Then it works fine. How do I properly compare against another EL expression?

Upvotes: 1

Views: 476

Answers (1)

BalusC
BalusC

Reputation: 1108632

This is indeed invalid syntax. You can't and shouldn't nest EL expressions. You should see the #{} as one whole scope where variables can interact with each other.

Given your desired comparison

createTicketBaseBean.show == I18N['key_please_select']

this is the proper syntax:

rendered="#{createTicketBaseBean.show == I18N['key_please_select']}"

Upvotes: 2

Related Questions