myfaces-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/MYFACES-3874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13944883#comment-13944883
] 

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="http://xmlns.jcp.org/jsf/passthrough" ...>

<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 http://xmlns.jcp.org/jsf, 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: https://issues.apache.org/jira/browse/MYFACES-3874
>             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="http://www.w3.org/1999/xhtml"
>       xmlns:f="http://xmlns.jcp.org/jsf/core"
>       xmlns:h="http://xmlns.jcp.org/jsf/html"
>       xmlns:jsf="http://xmlns.jcp.org/jsf"
> 	  xmlns:pt="http://xmlns.jcp.org/jsf/passthrough">
> <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(FacesServlet.java:230)
> root cause
> java.lang.IllegalArgumentException: Component property class is not writable
> 	javax.faces.component._ComponentAttributesMap.setComponentProperty(_ComponentAttributesMap.java:709)
> 	javax.faces.component._ComponentAttributesMap.put(_ComponentAttributesMap.java:584)
> 	javax.faces.component._ComponentAttributesMap.put(_ComponentAttributesMap.java:55)
> 	org.apache.myfaces.view.facelets.tag.jsf.ComponentRule$LiteralAttributeMetadata.applyMetadata(ComponentRule.java:52)
> 	org.apache.myfaces.view.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:45)
> 	javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:63)
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:90)
> 	org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:290)
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:50)
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:55)
> 	org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:373)
> 	javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:50)
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
> 	org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:59)
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
> 	javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
> 	org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
> 	org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:187)
> 	org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:477)
> 	org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:78)
> 	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267)
> 	javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
> note The full stack trace of the root cause is available in the Apache Tomcat/7.0.52
logs.
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message