> -----Original Message----- > From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 08, 2004 1:23 PM > To: 'Struts Users Mailing List' > Subject: RE: Date format woes > > > > From a pure JavaBean perspective, a class like: > > > > package com.dotech; > > > > import java.io.Serializable; > > import java.util.Date; > > > > public class ConfusedBean implements Serializable { > > public void setDate(String s) {} > > public Date getDate() { return null; } > > } > > > > is seen by Introspector as (Sun JDK 1.4.2_05-b04): > > > > Dumping Properties for: com.dotech.ConfusedBean > > > > class > > propertyType: class java.lang.Class > > readMethod: public final native java.lang.Class > > java.lang.Object.getClass() > > writeMethod: null > > date > > propertyType: class java.util.Date > > readMethod: public java.util.Date > > com.dotech.ConfusedBean.getDate() > > writeMethod: null > > ??? Makes no sense to me. "String" is a class but "Date" is a Date? It > transates a setter into a getter?? What?
You have, from the point of view of Java introspection, a setter for a property that doesn't exist called Date, and a getter for a property of type Date. So... introspection is apprently expecting the return type of the getter and the parameter type of the setter to be the same. Which makes the advice given here http://husted.com/struts/tips/013.html by Ted Husted much more relevant. > > > In other words, it has two properties: "class" and "date". > > The "date" property is read-only and is accessed through the > > "getDate" method. How are you trying to set the > > "expirationDate" property on your bean? > > Originally its set by a constructor, which takes a data object as an > argment. That data object is filled by reading the database. > expirationDate > is filled later by using the setDate(String....) setter. That's not relevant to what the introspection is seeing. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]