myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Commented] (MYFACES-3874) Component property class is not writable
Date Mon, 24 Mar 2014 10:14:43 GMT


Leonardo Uribe commented on MYFACES-3874:

I tried the code and indeed there is something missing. It is clear it is something outside
of the spec. I tried with Mojarra and it was fixed on 2.2.4, so 2.2.3 and earlier versions
has the problem.

I found a workaround for it, using passthrough namespace:

... xmlns:pt="" ...>

<div jsf:id="mw-page-base" pt:class="noprint"></div>

It works with MyFaces 2.2.2 and Mojarra 2.2.4 and upper versions. It is not the ideal but
it will work for the time being.

Use something like this:

<li jsf:class="toclevel-1 tocsection-2"/> 

Should not work. The javadoc of javax.faces.view.facelets.TagDecorator says this:

"... If the current attribute's namespace is, convertedTagAttribute's
qualified name must be the current attribute's local name and convertedTagAttribute's namespace
must be the empty string. This will have the effect of setting the current attribute as a
proper property on the UIComponent instance represented by this markup. ..."

Passthrough attributes map and normal attributes map are two different maps. This namespace
refers to the normal attribute map, so set jsf:class set the "class" property.

Historically in JSF the property "styleClass" has been used to overcome the problem, even
if it is finally rendered as "class" attribute in the html markup. In facelets, the class
HtmlComponentHandler has the following code:

    protected MetaRuleset createMetaRuleset(Class type)
        return super.createMetaRuleset(type).alias("class", "styleClass");

I suppose jsf:element component should have a similar rule, but that means the component should
have the property and the renderer should render it. That will work, but I'm going to ask
to some EG members to see if that approach is correct. 

> Component property class is not writable
> ----------------------------------------
>                 Key: MYFACES-3874
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.2
>         Environment: apache-tomcat-7.0.52, jdk1.6
>            Reporter: Krashan Brahmanjara
> Mojarra 2.2.6 accept jsf:class attribute without problem. Myfaces 2.2.2 no
> example
> {noformat}
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html [<!ENTITY nbsp "&#160;">]>
> <html dir="ltr" class="client-js ve-not-available" lang="en"
>       xmlns=""
>       xmlns:f=""
>       xmlns:h=""
>       xmlns:jsf=""
> 	  xmlns:pt="">
> <body>
> <li jsf:class="toclevel-1 tocsection-2"/>
> </body>
> </html>
> {noformat}
> Exception
> {noformat}
> HTTP Status 500 - Component property class is not writable
> type Exception report
> message Component property class is not writable
> description The server encountered an internal error that prevented it from fulfilling
this request.
> exception
> javax.servlet.ServletException: Component property class is not writable
> 	javax.faces.webapp.FacesServlet.service(
> root cause
> java.lang.IllegalArgumentException: Component property class is not writable
> 	javax.faces.component._ComponentAttributesMap.setComponentProperty(
> 	javax.faces.component._ComponentAttributesMap.put(
> 	javax.faces.component._ComponentAttributesMap.put(
> 	org.apache.myfaces.view.facelets.tag.jsf.ComponentRule$LiteralAttributeMetadata.applyMetadata(
> 	org.apache.myfaces.view.facelets.tag.MetadataImpl.applyMetadata(
> 	javax.faces.view.facelets.MetaTagHandler.setAttributes(
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(
> 	org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.apply(
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(
> 	org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.apply(
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(
> 	org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(
> 	org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(
> 	org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(
> 	org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(
> 	org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(
> 	org.apache.myfaces.lifecycle.LifecycleImpl.render(
> 	javax.faces.webapp.FacesServlet.service(
> note The full stack trace of the root cause is available in the Apache Tomcat/7.0.52
> {noformat}

This message was sent by Atlassian JIRA

View raw message