2 EL in a same value

1

My outputText looks like this:

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

I'm trying to make a condition it would have but it does not accept and the screen is not rendered, does anyone know if it's possible to do and how would it be?     

asked by anonymous 06.04.2017 / 18:12

1 answer

0

Within a ternary operator, you can not place two bean values the same way you did. You need 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: You must make sure that the variables bean.codigo and bean.loja are actually Strings, otherwise a cast error will occur.

    
09.04.2017 / 00:12