You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Vivek Pandey <vi...@sca-tech.com> on 2006/09/29 10:16:53 UTC

RE: How to access f:attribute

See if this helps

http://punterpandey.blogspot.com/2006/09/fattribute-tag-in-jsf.html

 

Vivek Pandey | SCA Technologies LLC, Gurgaon | 91-9818872105 



  _____  

From: Matta, Keerthi [mailto:Keerthi.Matta@ibtco.com] 
Sent: Friday, September 29, 2006 12:32 AM
To: MyFaces Development
Subject: RE: How to access f:attribute

 

Small correction in Java code:

 

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(fieldRefValue.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

 

 

  _____  

From: Matta, Keerthi [mailto:Keerthi.Matta@ibtco.com] 
Sent: Thursday, September 28, 2006 3:00 PM
To: dev@myfaces.apache.org
Subject: 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.
****************************************************************************
*



**************************************************************************
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.
****************************************************************************
*