This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Adaption of roles in Struts menu not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Adaption of roles in Struts menu not working" Watch "Adaption of roles in Struts menu not working" New topic

Adaption of roles in Struts menu not working

Ayyappan Selvaraj
Ranch Hand

Joined: Sep 20, 2004
Posts: 63

I'm trying to implement the rolesAdpation in Struts menu, but I find that its not working. Im pasting the code snippet that I use.

1) in my User POJO i have a variable defined as
private RoleMaster roles; and getters and setters for it.

2) in the User.hbm.xml file, I have a relation like this
many-to-one name="roles" class="com.cpt.liscommon.model.RoleMaster"
cascade="none" outer-join="auto" column="RM_ROLE_ID"
fetch="join" lazy="false"

3) in my menu.jsp I have it as
" menu:useMenuDisplayer name="Velocity" config="/menu.vm" permissions="rolesAdapter"
menu isplayMenu name="menu.application"
menu isplayMenu name="menu.users"
menu isplayMenu name="menu.reports"
menu:useMenuDisplayer "

4) in my menu-confif file

" Menu name="menu.application" title="menu.application.title" description="Application Tables Menu"
Item name="menu.hospitalMaster.load" title="" forward="hospitalMaster.load" roles="1000"
Item name="menu.department.load" title="menu.department.load" forward="department.load" roles="1001"
Item name="menu.module.load" title="menu.module.load" forward="module.load" roles="1001"
Item name="menu.transaction.load" title="menu.transaction.load" forward="transaction.load"
Menu "

For the last item i didnt give the rols attribute....

5) I login with a user whose role is 1000 and so I should be able to view the 1st, 2nd and 4th items in the menu.
But any item with roles attribute doesnt appear...The 4th one without the roles attribute alone appears.

Please help me and guide me how to fix it.

Thanks in advance
subject: Adaption of roles in Struts menu not working
Similar Threads
problem in generating dynamic menu in struts, through actionForms
Getting error with Struts-menu
Struts Menu-Spring Security with roles adapter
struts attribute
Trying to internationalize menu tabs using Struts-menu with struts 2