Sign in to follow this  
Followers 0

java contains() always returning false in JSF

1 post in this topic

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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.