RE: Could not find an adaptor for class X

"Malcolm Edgar" <[email protected]> Thu, 13 Feb 2003 04:29:41 +0800
Newsgroups gmane.comp.java.tapestry.devel
Message-ID <[email protected]>
Hi Joseph,

sounds like you are using a T2.4 alpha, as adaptor are used in this release. 
My understanding is that any persistent properties need to implement 
java.io.Serializable. Your Person object should implement this interface.

regards Malcolm

>From: "Meade, Joseph L" <[email protected]>
>To: "Tapestry-Developer (E-mail)" 
><[email protected]>
>Subject: RE: [Tapestry-developer] Could not find an adaptor for class X
>Date: Wed, 12 Feb 2003 09:01:05 -0500
>
>
>Here are PersonList.java and Person.java:
>
>//PersonList.java
>
>import net.sf.tapestry.IRequestCycle;
>import net.sf.tapestry.html.BasePage;
>import java.util.List;
>import java.util.Vector;
>
>public class PersonList extends BasePage
>{
>	private List personList = new Vector();
>	private Person jondough;
>	private SQL sql = new SQL();
>
>
>	public List getPersonList()
>	{
>		if(personList.size() == 0)
>			personList = sql.getPersonList();
>		return personList;
>	}
>	public void setPersonList(List personList)
>	{
>		this.personList = personList;
>	}
>	public Person getJondough()
>	{
>		return jondough;
>	}
>	public void setJondough(Person jondough)
>	{
>		this.jondough = jondough;
>	}
>
>
>
>	/**
>	 *  Receives the click on a personID, setting the personID and
>	 *  Person attributes.
>	 */
>	public void selectPerson(IRequestCycle cycle)
>	{
>		Object[] parameters = cycle.getServiceParameters();
>		int personID = ((Integer)parameters[0]).intValue();
>
>		Person jonDough;
>
>		jonDough = sql.getPerson(personID);
>
>		if(jonDough == null)  // this should never happen
>			cycle.setPage("NewPerson");
>
>		else  // A valid person, go to forms.
>		{
>			Visit visit = (Visit) getVisit();
>			visit.setPerson(jonDough);
>			cycle.setPage("Forms");
>		}
>	}
>
>	public PersonList()
>	{
>
>	}
>
>	public static void main(String[] args)
>	{
>		PersonList pl = new PersonList();
>		List l = pl.getPersonList();
>		System.out.println(l);
>	}
>
>}
>
>//EOF
>
>//Person.java:
>
>public class Person
>{
>	//attributes
>	private int personID;
>	private String address;
>
>	//accessors
>	public int getPersonID()
>	{
>		return personID;
>	}
>	public void setPersonID(int personID)
>	{
>		this.personID = personID;
>	}
>	public String getAddress()
>	{
>		return address;
>	}
>	public void setAddress(String address)
>	{
>		this.address = address;
>	}
>
>
>	//helpers
>	public void showPerson()
>	{
>		System.out.println("PersonID:\t" + getPersonID());
>		System.out.println("Address:\t" + getAddress());
>	}
>
>	//constructors
>	public Person(int personID, String address)
>	{
>		setPersonID(personID);
>		setAddress(address);
>	}
>
>	public Person(int personID)
>	{
>		this(personID, null);
>	}
>
>	public Person()
>	{
>		this(555);
>	}
>
>	public static void main(String[] args)
>	{
>		Person joeDemo = new Person();
>		joeDemo.showPerson();
>	}
>
>}
>//EOF
>
>Thanks for taking a look!
>
>Joe Meade
>[email protected]
>
>
>-----Original Message-----
>From: Adam Greene [mailto:[email protected]]
>Sent: Wednesday, February 12, 2003 8:09 AM
>To: Meade, Joseph L; [email protected]
>Subject: Re: [Tapestry-developer] Could not find an adaptor for class X
>
>
>Send an email with your .java file, the problem is in there.
>----- Original Message -----
>From: "Meade, Joseph L" <[email protected]>
>To: <[email protected]>
>Sent: Tuesday, February 11, 2003 5:37 PM
>Subject: [Tapestry-developer] Could not find an adaptor for class X
>
>
>I'm working very hard to wrap my brain around Tapestry concepts and syntax,
>but need some help with this one.
>
>I keep getting an exception with the text "Could not find an adaptor for
>class Person".
>
>On a PersonList page, I've got a Foreach component that has as its source a
>List of Person objects.  I then need to access attributes of each object.
>It's really straightforward and not unlike some of the tutorials.
>
>Here's the clip from the PersonList.page file:
><component id="e" type="Foreach">
>     <binding name="source" expression="personList"/>
>     <binding name="value" expression="jondough"/>
></component>
><component id="insertPersonID" type="Insert">
>     <binding name="value" expression="jondough.personID"/>
></component>
><component id="insertAddress" type="Insert">
>     <binding name="value" expression="jondough.address"/>
></component>
>
>What is an adaptor?  The Person class is in the same directory as the
>PersonList class.  I've been working on this one all day.  Thanks in 
>advance
>for your help!
>
>
>Joe Meade
>[email protected]
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by:
>SourceForge Enterprise Edition + IBM + LinuxWorld =omething 2 See!
>http://www.vasoftware.com
>_______________________________________________
>Tapestry-developer mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/tapestry-developer
>
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by:
>SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
>http://www.vasoftware.com
>_______________________________________________
>Tapestry-developer mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/tapestry-developer


_________________________________________________________________
Hotmail now available on Australian mobile phones. Go to  
http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf