2 EL at the same value

Asked

Viewed 45 times

1

My outputText is like this:

<p:outputLabel id="codigoGrid" value="#{bean.loja eq null ? bean.codigo : bean.codigo bean.loja}" />

I am trying to make a tenacious condition but it does not accept and the screen is not rendered, someone knows if it is possible to do and how it would be ?

1 answer

0

Inside a ternary operator you can’t put two bean values in the same way you did. It’s necessary to concatenate the results if you want to do it, like this:

<p:outputLabel id="codigoGrid" value="#{bean.loja eq null ? bean.codigo : bean.codigo + ' ' + bean.loja}" />

Note: It is necessary to make sure that the variables bean.codigo and bean.loja are in fact Strings, otherwise a cast error will occur.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.