Welcome Guest! To access all forums & features, please register an account or sign-in. → Why register?



contains() always returning false in JSF


No replies to this topic - - - - -

#1 Lord Method Man

    Resident Fanatic

  • 752 posts
  • Joined: 18-September 12
  • OS: Windows 7 Ultimate 64-bit

Posted 18 October 2012 - 13:56

I'm trying to redo how a website handles permission access to elements. Right now we have it so when someone logs in (ActiveUser) they have an ArrayList of Integers corresponding to the FunctionIDs they are permitted access to. For example when I log in I have the values 1, 2, 6, 7 in my ActiveUser.permissions List.

The problem is that I'm trying to render elements in JSF using <h:tag rendered="#{activeUser.permissions.contains(x)}"> for elements. This is always returning false regardless of the values in the List. I have verified that the value is in fact in my List using Debugging mode.

Also, if I replace #{activeUser.permissions.contains(1)} with #{activeUser.permissions.get(0) == 1} it works and the element renders. I know that .contains(<literal int>) works for java.lang.Integers, so I have the feeling this has something to do with JSF.