• 0

contains() always returning false in JSF


Question

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.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.