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

Reply via email to