RE: Could not find an adaptor for class X

"Meade, Joseph L" <[email protected]> Wed, 12 Feb 2003 16:36:41 -0500
Newsgroups gmane.comp.java.tapestry.devel
Message-ID <A594A186D0C36944AF95B53D907250F157BBCA@HSCEMAIL1.hscs.virginia.edu>
Malcolm,=20

I'm using 2.3 beta, but you're right.

In my page file, I had a DirectLink component with a parameter of type =
Person, then had the listener set up to catch an int.  It was =
foreachPerson.value and should have been person.personID.

Thanks so much.

Joe Meade
[email protected]


-----Original Message-----
From: Malcolm Edgar [mailto:[email protected]]
Sent: Wednesday, February 12, 2003 3:30 PM
To: Meade, Joseph L; [email protected]
Subject: RE: [Tapestry-developer] Could not find an adaptor for class X


Hi Joseph,

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

regards Malcolm

>From: "Meade, Joseph L" <[email protected]>
>To: "Tapestry-Developer (E-mail)"=20
><[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 =3D new Vector();
>	private Person jondough;
>	private SQL sql =3D new SQL();
>
>
>	public List getPersonList()
>	{
>		if(personList.size() =3D=3D 0)
>			personList =3D sql.getPersonList();
>		return personList;
>	}
>	public void setPersonList(List personList)
>	{
>		this.personList =3D personList;
>	}
>	public Person getJondough()
>	{
>		return jondough;
>	}
>	public void setJondough(Person jondough)
>	{
>		this.jondough =3D jondough;
>	}
>
>
>
>	/**
>	 *  Receives the click on a personID, setting the personID and
>	 *  Person attributes.
>	 */
>	public void selectPerson(IRequestCycle cycle)
>	{
>		Object[] parameters =3D cycle.getServiceParameters();
>		int personID =3D ((Integer)parameters[0]).intValue();
>
>		Person jonDough;
>
>		jonDough =3D sql.getPerson(personID);
>
>		if(jonDough =3D=3D null)  // this should never happen
>			cycle.setPage("NewPerson");
>
>		else  // A valid person, go to forms.
>		{
>			Visit visit =3D (Visit) getVisit();
>			visit.setPerson(jonDough);
>			cycle.setPage("Forms");
>		}
>	}
>
>	public PersonList()
>	{
>
>	}
>
>	public static void main(String[] args)
>	{
>		PersonList pl =3D new PersonList();
>		List l =3D 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 =3D personID;
>	}
>	public String getAddress()
>	{
>		return address;
>	}
>	public void setAddress(String address)
>	{
>		this.address =3D 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 =3D 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=3D"e" type=3D"Foreach">
>     <binding name=3D"source" expression=3D"personList"/>
>     <binding name=3D"value" expression=3D"jondough"/>
></component>
><component id=3D"insertPersonID" type=3D"Insert">
>     <binding name=3D"value" expression=3D"jondough.personID"/>
></component>
><component id=3D"insertAddress" type=3D"Insert">
>     <binding name=3D"value" expression=3D"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=20
>advance
>for your help!
>
>
>Joe Meade
>[email protected]
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by:
>SourceForge Enterprise Edition + IBM + LinuxWorld =3Domething 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 =3D 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 =20
http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp



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