This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adaption of roles in Struts menu not working

Ayyappan Selvaraj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic