• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF rendered

 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

There is an existing JSF code where there is a menu with a header and two menuitems.
The code is as follows


My task is to reduce its visiblity only to those who are logged in as Admin. I have written the backing bean code and its fine. The problem, I have is on how to reduce the visiblity of this entire menu only for Admin. I tried this, but that does not have any effect.



I tried one more way that solved a part of the problem, but not the whole. The following code made the menu items disappear, but it had the following problems.
The header label "#{msg.menu_usage}" remained and so is the box that is to contain the menu items.
The two menu items disappeared, but the tiny boxes in front of them remained. These boxes are links of the hidden links.



I have to hide the enture menu item box "#{msg.menu_usage}" for all who are not "#{Login.admin}"

May I request the JSF experts in this forum to provide me with the insight.

Thanks,
Raj
 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I just noticed that menuitem is a custom tag that is present in one of our libraries. however, i did not understand the code. I am new to JSF.
is there a easier way to solve the problem?

regards,
Raj
 
Tim Holloway
Bartender
Posts: 18418
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that the rendering code for this custom tag may not be following protocol properly and rendering when it shouldn't, but that is only a guess. You can probably work around this by wrapping the menuItem within a 1x1 panelGrid and using its "rendered" attribute as long as that can be done without annoying other objects in the menu subtree.

In the general nit-picking department, however, I should note that backing bean names should not begin with an upper-case letter, since they are instance names, not class names. And that apparently you are using user-written login code instead of a standard security framework. The technical term for that is "hacked".
 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tim,

Many thanks for helping me avoid the longer route.

The Panel grid, however, got tangled with the custom components.

I used this code and that solved my problem for now.


Regards,
Rajesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!