That information is on pp. 108-114 of Hans Bergsten's book JavaServer
Faces (O'Reilly), or pp. 92-93 of Sun's book Core JavaServer Faces
(Prentice Hall).

- Brendan

-----Original Message-----
From: Eric Knapp [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 10, 2005 9:02 AM
To: MyFaces Discussion
Subject: Re: Selective Component Display


Craig,

Thank you very much for the quick and great response. I had not
noticed that attribute in all my reading. I see it now, but it is not
really emphasized anywhere that I can find. Is there a good repository
of this level of information or should I just keep posting questions?


On 6/9/05, Craig McClanahan <[EMAIL PROTECTED]> wrote:
> On 6/9/05, Eric Knapp <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I am learning JSF and MyFaces this summer. I am looking for a
> > best-practice or even just good ideas about something. I have a
> > question about selectively displaying components. Here is an example
> > of what I mean. I would like to have one page that shows a different
> > dataTable depending on the authentication role of a user. A normal
> > user would see a general HTML table while an admin user would see
more
> > columns and maybe an edit button.
> >
> > Without JSF I would do this with lots of JSTL. What's the best JSF
> > way? I have been looking at Tiles too but that doesn't seem to point
> > to the future of JSF.
> >
> 
> A very common approach for selective display of JSF components is to
> use a value binding on the "rendered" property (which all components
> should be implementing), binding it to a method returning a boolean
> that can determine whether this component, and all its children,
> should be rendered or not.
> 
> Assume you have a session-scoped "user" bean representing the current
> user, with an isManager() method that returns boolean.  You can
> restrict display of salary information in an HR application with
> something like this:
> 
>   <h:outputText value="#{employee.salary}" ...
rendered="#{user.manager}" .../>
> 
> Craig
>

Reply via email to