Is it possible to make rendering of standard JSF html components role-dependent? Smth like disabling input for some fields in the form for some roles. [ March 04, 2004: Message edited by: Yuri Sforza ]
Bill Dudney
Author
Ranch Hand
Joined: Sep 05, 2003
Posts: 234
posted
0
That is a great question. I've not tried it myself but I expect you could do something like this <h:commandButton ... id="1" rendered=#{securityBean.shouldRender["1"]} .../> In the shouldRender method calculate the boolean value for each control and populate a map with these values. Then return the map. The EL stuff will evaluate it see true/false and the button will be rendered or not. As I said I've not tried this and its a bit of a kludge since now the component knows its id as well as the security bean (info in two places is an invitation for bugs...). But I'm fairly sure this would work as a first approximation. I'll try to cook up an example and post it to my blog in the next couple of weeks.