Menu

#58 Attribute class hidden in AbstractHTMLBaseTag.

open
nobody
TagLibrary (33)
5
2013-01-13
2004-12-30
sneville
No

Using 0.9.8, I cannot compile a JSP that uses a tag
that defines a value for the class attribute. The tag
on the JSP is <cewolf:img chartid="timeChart"
renderer="/cewolf" width="350" height="275"
class="chart"/>. The error message is 'Unable to find
setter method for attribute: class'.

The problem appears to be that the write-only class
property in AbstractHTMLBaseTag is hidden by the
read-only class property in java.lang.Object. Since
they are of different types, the set method appears to
be getting hidden when Jasper does bean introspection.

I am using Tomcat 5 and JDK 1.4.2.

Discussion

  • Brian Fox

    Brian Fox - 2005-01-07

    Logged In: YES
    user_id=805618

    The internal variable is called clazz and object doesn't
    have a setClass method...how could this be confused?

     
  • sneville

    sneville - 2005-01-07

    Logged In: YES
    user_id=1187414

    When the bean introspector gets a list of all properties for
    the AbstractHTMLBaseTag class, it only sees the read-only
    class property defined by the class java.lang.Class. It
    never sees the writeable class property defined by
    AbstractHTMLBaseTag. If a read-only and a write-only
    property have different types, then the read-only property
    will take precedence.

    I am attaching a sample file which looks up the properties
    in the same way that Jasper does. Notice, there is no setter
    for the class.

     
  • sneville

    sneville - 2005-01-07

    Example which shows that a property named class is always read-only.

     

Log in to post a comment.