<x:commandLink/> Atrribute  'value' is not rendered in combination with 
'enabledOnUserRole'
-------------------------------------------------------------------------------------------

         Key: MYFACES-637
         URL: http://issues.apache.org/jira/browse/MYFACES-637
     Project: MyFaces
        Type: Bug
  Components: Tomahawk  
    Versions: 1.0.9m9, 1.1.0    
    Reporter: Sascha Groß


The  value of  the Component  <x:commandLink>  is not rendered, when using 
attribute 'enabledOnUserRole' and the current user hasn't the role.

Example:
<x:commandLink 
  value="Hallo commandLink" 
  action="#{.....}"
  enabledOnUserRole="enableLinks"
/>

If the user hasn't the role 'enableLinks' 'Hallo commandLink' isn't rendered.


Prepared Fix:
class org.apache.myfaces.renderkit.html.ext.HtmlLinkRenderer 
change methode  
    protected void renderCommandLinkStart(FacesContext facesContext,
                                          UIComponent component,
                                          String clientId,
                                          Object value,
                                          String style,
                                          String styleClass) throws IOException
    {
        //if link is disabled we render the nested components without the anchor
        if (UserRoleUtils.isEnabledOnUserRole(component))
        {
            super.renderCommandLinkStart(facesContext, component, clientId, 
value, style, styleClass);
        }
    }

to 

    protected void renderCommandLinkStart(FacesContext facesContext,
                                          UIComponent component,
                                          String clientId,
                                          Object value,
                                          String style,
                                          String styleClass) throws IOException
    {
        //if link is disabled we render the nested components without the anchor
        if (UserRoleUtils.isEnabledOnUserRole(component))
        {
            super.renderCommandLinkStart(facesContext, component, clientId, 
value, style, styleClass);
        } else {
            // render value as required by JSF 1.1 renderkitdocs
            if(value != null)
            {
                ResponseWriter writer = facesContext.getResponseWriter();
                
                writer.writeText(value.toString(), JSFAttr.VALUE_ATTR);
            }
        }
    }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to