-1

I am using h:panelGrid for 2 columns: drop-down list and Login button

StatusBar

I created boolean var hasMoreThanOneCacUser with getters & setters (I set it when i create drop-down list):

public boolean isHasMoreThanOneCacUser() {
        return hasMoreThanOneCacUser;
    }

    public void setHasMoreThanOneCacUser(boolean hasMoreThanOneCacUser) {
        this.hasMoreThanOneCacUser = hasMoreThanOneCacUser;
    }

I need to hide <h:selectOneMenu > and <:h:commandLink>

I tried adding rendered to panelGrid:

rendered="#{visit != null && editProfileBean.hasMoreThanOneCacUser}"

I also tried on <h:selectOnemenu> and <h:commandLink>

rendered=#{editProfileBean.hasMoreThanOneCacUser}

None of these seem to do the trick. It causes page not to render selectOneMenu and commandLink.

It's not hasMoreThanOneCacUser because I saw it gets set to true

Does anyone see what I am doing wrong? I am using JSF 1.0

Angelina
  • 2,175
  • 10
  • 42
  • 82

1 Answers1

0

Try using this:

rendered="#{not editProfileBean.hasMoreThanOneCacUser}"

You have to be careful of differences in syntax when using Expression Language (EL). There are some good Stack Overflow posts which explain the differences...

Difference between JSP EL, JSF EL and Unified EL

Community
  • 1
  • 1
LiamWilson94
  • 458
  • 2
  • 7
  • 26
  • That didn't work :( and I want it only for selectOneMenu and commandLink. – Angelina May 19 '15 at 14:30
  • 1
    So you want to "hide" or not render both the menu and the link when editProfileBean.hasMoreThanOneCacUser evaluates to false? So what determines whether something is rendered? Is it the "visit" variable or the boolean hasMoreThanOneCacUser which is stored in the bean? Or both variables in combination? – LiamWilson94 May 19 '15 at 14:33
  • Yes, I want to "hide" drop-down list and the link when editProfileBean.hasMoreThanOneCacUser evaluates to false?. Just hasMoreThanOneCacuser. – Angelina May 19 '15 at 14:44
  • 1
    I have edited my answer with some different code to try in the rendered attribute. If your boolean value is set correctly, I am not sure why this would not work. you could also try placing the same rendered tag on all components that you do not want to be displayed? – LiamWilson94 May 19 '15 at 15:35