Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic Javascript and Spring

 
Charles Owen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[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
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Charles Owen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We resolved this by creating a tiles definition for the tabs, then using a combination of CSS, Javascript, and JSTL.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic