The type is actually the problem.

It is actually a java.lang.String but the getter and setter on it are defined 
by a generic interface :

// INTERFACE (Identifiable.java) :
public interface Identifiable<T> {
        public void setId(T id);
        public T getId();
}

// POJO TO DISPLAY IN FORM (MyPojo.java):
public class MyPojo implements Identifiable<String> {
        private String id;
        private String name;
        public String getId() {
                return id;
        }
        public void setId(String id) {
                this.id = id;
        }
        public String getName() {
                return name;
        }
        public void setName(String name) {
                this.name = name;
        }
}

// FORM TEMPLATE (TestGeneric.tml):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";
      xmlns:p="tapestry:parameter">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
        <body>
                <t:form t:id="myFrom">
                        <t:textfield t:id="pojoId" t:value="myPojoInstance.id" 
/>
                        <t:textfield t:id="pojoName" 
t:value="myPojoInstance.name" />
                </t:form>
        </body>
</html>

// PAGE CODE (TestGeneric.java):
public class TestGeneric {
        public MyPojo getMyPojoInstance() {
                MyPojo pojo = new MyPojo();
                pojo.setId("F7U12");
                pojo.setName("Narwhal");
                return pojo;
        }
}

-----Original Message-----
From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] 
Sent: Friday, July 15, 2011 1:45 PM
To: 'Tapestry users'; Nicolas Gillet - MARKET-IP
Subject: Re: Generic interface, issue in TML

On Fri, 15 Jul 2011 06:55:30 -0300, Nicolas Gillet - MARKET-IP  
<nicolas.gil...@market-ip.com> wrote:

> Hello,

Hi!

> org.apache.tapestry5.ioc.internal.util.TapestryException: Parameter
> 'translate' of component test/Generic:pojoid is bound to null. This
> parameter is not allowed to be null. [at
> classpath:com/marketip/geoplanning/web/pages/test/TestGeneric.tml, line  
> 11]

What's the type of Generic.pojoid?

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to