How do I specify conditions from 2 different beans in a jsf rendered attribute?
Asked Answered
R

3

9

I want to do something along the lines of the following but when I use it like this I get a parse error telling me an entity needs to directly follow the '&' character:

<ice:selectManyCheckbox
rendered="#{!bean1.condition1 && bean2.condition2}"
value="#{bean1.selected}">
<f:selectItems value="#{bean2.items}" />
</ice:selectManyCheckbox>

How can I get rendered to check conditions from 2 different beans?

Roe answered 16/6, 2009 at 23:16 Comment(0)
D
13

Use 'and' instead:

<ice:selectManyCheckbox rendered="#{!bean1.condition1 and bean2.condition2}" value="#{bean1.selected}">
Dehumidifier answered 16/6, 2009 at 23:26 Comment(1)
Probably should have tried that before asking. Good to know though, thanks.Roe
C
4

karim79 is right, you can just use the and operator.

In addition to that, you can have a look to this page, which explains the Expression Language (EL) with several examples...

Climactic answered 17/6, 2009 at 7:0 Comment(0)
R
0

Maybe you are using facelets which assumes every jsp page after compilation is a xml file. And you know in an xml file you have to provide an xml entity name just after the & symbol. So to escape this situation use &amp; in place of &.

Raleighraley answered 4/6, 2012 at 5:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.