I believe if you really need both setters, you should create both getters. Edgar
-----Original Message----- From: Sri Sankaran [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 1:54 PM To: 'Struts Users Mailing List' Subject: [OT] Overloaded setters in JavaBeans It is now a well-known fact on this list that if you are trying to access a property using a tag you had better not have an overloaded setter for this property. In other words don't do private String foo; public String getFoo() { return foo; } public void setFoo(String x) { foo = x; } public void setFoo(int i) { foo = "" + x; } Equally well-known is the reason -- "'tis the JavaBeans specification". So, I went looking. Section 7.1 (Accessor methods) reads Begin quote --- Properties are always accessed via method calls on their owning object. For readable properties there will be a getter method to read the property value. For writable properties there will be a setter method to allow the property value to be updated. --- End quote Section 8.3 ("Design Patterns for Properties") reads Begin quote --- By default, we use design patterns to locate properties by looking for methods of the form: public <PropertyType> get<PropertyName>(); public void set<PropertyName>(<PropertyType> a); If we discover a matching pair of "get<PropertyName>" and "set<PropertyName>" methods that take and return the same type, then we regard these methods as defining a read-write property whose name will be "<propertyName>". ... If we find only one of these methods, then we regard it as defining either a read-only or a writeonly property called "<propertyName>" --- End quote It doesn't say anything about not overloading the accessors. So, why then do we get the error? Sri -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>