Forums Register Login

Displaying Roles in JSTL

+Pie Number of slices to send: Send
Hi All,

Now, i have two objects returning from my controller, they are availableRoles and havingroles. In my JSP page, i need to display all the available roles and check whether user is having that role, i.e in havingRoles, if yes check the checkbox. I know to use forEach is JSTL. Can you please tell me how to proceed with this task.
+Pie Number of slices to send: Send
Seems pretty straight-forward, no? What specifically is giving you a problem?

Although to be honest, I'd do more of this work on the server side, or use a map, or something, otherwise you'll end up doing nested loops.
+Pie Number of slices to send: Send
Thanks David for the reply, now i am bothered with how to check for roles in having Roles. i.e how can we check for havingRoles.contains(availableRoles.get(i)) in JSTL. Also, can you please elaborate on which you told that, you will be doing that in a server side..
+Pie Number of slices to send: Send
The EL cannot access general methods in a class -- it expects the information passed to the JSP to be patterned as beans. So you should be exposing your role information in a way that's suitable for the JSP, rather than trying to contort the JSP into accessing information that's poorly suited for the task.

Perhaps this article might be helpful.
Did you just should on me? You should read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2130 times.
Similar Threads
Find length
Workflow framework in Websphere Portal 6.0
How get all User's roles in JSP/Servlet?
Update Page with a PopUp
why ${fn:substring("123456",1,2)} work in jstl 1.0?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:18:01.