RE: Could not find an adaptor for class X
"Meade, Joseph L" <[email protected]> Wed, 12 Feb 2003 09:01:05 -0500
| Newsgroups | gmane.comp.java.tapestry.devel |
|---|---|
| Message-ID | <A594A186D0C36944AF95B53D907250F157BBC9@HSCEMAIL1.hscs.virginia.edu> |
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 =
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 = Something 2 See!
http://www.vasoftware.com