[Logo]
Forums Register Login
Dynamic Javascript and Spring
I am using Spring with JSTL to present information on a web page. I will need to build a tabbed menu dynamically based on user credentials. For example one user may end up with 4 tabs and another with 2. I could do this rather easily with ASP.NET by injecting dynamic javascript into the asp.net page event. But I am not sure how I would do this in Spring and JSTL. Any help is appreciated.
[quote=Charles Owen]I am using Spring with JSTL to present information on a web page. I will need to build a tabbed menu dynamically based on user credentials. For example one user may end up with 4 tabs and another with 2. I could do this rather easily with ASP.NET by injecting dynamic javascript into the asp.net page event. But I am not sure how I would do this in Spring and JSTL. Any help is appreciated.[/quote]

With Spring Security it is extremely easy. Just use the Spring security tag library in your page. <security:ifAnyGranted={}> That isn't the exact tag, but the tag is just like that and anything between the open and close tag will only appear if the user has any of the roles stated in the tag for ifAnyGranted, that you write.

Mark
Here is a link to the Spring Security documentation on JSP tag libs

Tag lib documentation

It is also useful to note that you can use SPEL which makes it even more powerful as Craig Walls pointed out in THIS POST
We resolved this by creating a tiles definition for the tabs, then using a combination of CSS, Javascript, and JSTL.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Oct 22, 2017 06:40:55.