tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Why can I not use attributes "lang" and "maxRows" in a custom tag
Date Sun, 24 Nov 2002 00:15:08 GMT

On Sat, 23 Nov 2002, Paul Speed wrote:

> Date: Sat, 23 Nov 2002 18:50:34 -0500
> From: Paul Speed <>
> Reply-To: Tomcat Developers List <>
> To: Tomcat Developers List <>
> Subject: Re: Why can I not use attributes "lang" and "maxRows" in a
>     custom tag
> The Java beans API requires getters.  It does not require setters.
> No setter means the property is read-only.  There's no such thing as
> write-only in the Java beans API.

That turns out not to be the case.

Section 8.3.1 of the JavaBeans Specification makes it clear that you can
have either a read-only or a write-only property, in addition to a
read-write property.

JSP custom tags are a pretty good use case for write-only properties --
the JSP contracts only require an ability to *set* the property values;
there is no requirement that the attribute values be made publicly
available to any other class.  After all, the tag implementation class
will have internal access to the set value, by referencing whatever
instance variable the setter stored it in.

> A getter is the only way to determine what the type of the property
> is since there can be only one getter with a particular name.  The
> Java beans API is all about deducing all of this information at
> runtime... so it must be able to figure this out. (For
> PropertyDescriptors and such.)

The user's original problem wasn't that they had a write-only property.
The problem was that the data type of the getter and setter did not match,
which violates the design patterns of Section 8.3.  Therefore, te
JavaBeans introspector does not consider this to be an actual JavaBeans

> Not 100% useful as a way to do simple reflection though.
> -Paul


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message