Class mypack.pages.User已经转化,可能无法直接实例化

Class mypack.pages.User has been transformed and may not be directly instantiated

我正在尝试基于此 Tutorial 显示带有挂毯的网格,但出现此错误 Class mypack.pages.User has been transformed and may not be directly instantiated 这些是我的 类 用户

    public class User {     
        @NonVisual
        private long id;

        private String firstName;

        private String lastName;

        private int age;

        public long getId() { return id; }

        public void setId(long id) { this.id = id; }

        public String getFirstName() { return firstName; }

        public void setFirstName(String firstName) { this.firstName = firstName; }

        public String getLastName() { return lastName; }

        public void setLastName(String lastName) { this.lastName = lastName; }

        public int getAge() { return age; }

        public void setAge(int age) { this.age = age; }

        public User(long id, String firstName, String lastName, int age) {
            super();
            this.id = id;
            this.firstName = firstName;
            this.lastName = lastName;
            this.age = age;
        }
}

Bellilpage.java

public class Bellilpage {
     @Property
        private User user;

    public List<User> getUsers() { 

         List<User> dd= new ArrayList<User>();
         for(int x=0;x<1;x++)
         {
             Random rand = new Random(); 
             long d= rand.nextInt(50);
            User myuser = new User(d, "Name N° "+d, "lastName N "+d, (int) (d+15));

        dd.add(myuser);
         }

         return dd; }

}

最后这就是我尝试在网页中显示网格的方式 Bellilpage.tml

<html t:type="layout" title="tapestrythetest Index"
      t:sidebarTitle="Framework Version"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
      xmlns:p="tapestry:parameter">
    <!-- A Zone is a component that can be updated in place, triggered by other components. -->
    <t:zone t:id="zone">
      <h1>List Users</h1>

        <t:grid source="users"  row="user">
            <p:lastNameCell>
           ${user.lastname} 
            </p:lastNameCell>

        </t:grid>
    </t:zone>

    <p:sidebar>

    </p:sidebar>

</html>

为什么我打开 Bellilpage.tml 时出现此错误?

您收到错误消息是因为 mypack.pages 是 T5 受控程序包。将您的 User class 移动到不同的包,例如到 mypack.entities。 Component Classes 中的更多信息,特别是组件包部分。