You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Matta, Keerthi" <Ke...@ibtco.com> on 2006/09/28 20:59:36 UTC

How to access f:attribute

Hi,

 

I have a requirement around component level security, depending on the
user role a particular component in the page should be displayed.

I am trying to achieve this functionality by identifying the component
which is having a specific attribute called "needProtection".

I am trying to retrieve this information about the component in the
PhaseListener, and depending on the role I am trying to update rendered
property of the component to "true" or "false".

I am setting a component as follows in the JSP page:

 

<h:commandButton value="submit" style="width:95px"
action="#{actionHandler.login}">

      <f:attribute name="needProtection" value="AOP"/>

</h:commandButton>

 

I am calling the following method to get attribute information:

 

if (component.getAttributes().containsKey("needProtection ")) {

                                      String fieldRefValue =
component.getAttributes().get("needProtection ").toString();

                                      if(needProtection.equals("AOP")) {

 
component.setRendered(false);

                                      }

                             }

 

The problem I am currently facing is, I am not able to retrieve the
attribute information set in the JSP page in the PhaseListener.

A snippet of code which is able to retrieve attribute information would
be helpful very much.

 

Thanks in advance,

Keerthi

 



**************************************************************************
This message and any attached documents contain information
which may be confidential, subject to privilege or exempt from
disclosure under applicable law.  These materials are solely for 
the use of the intended recipient.  If you are not the intended
recipient of this transmission, you are hereby notified that any
distribution, disclosure, printing, copying, storage, modification 
or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other
than the intended recipient shall not compromise or waive 
such confidentiality, privilege or exemption from disclosure as
to this communication.  

If you have received this communication in error, please notify
the sender immediately and delete this message from your system.
*****************************************************************************