On Sun, 25 Jan 2015 06:33:19 -0200, Cheng Zhang
<charlesdenverj...@gmail.com> wrote:
Hi All,
Hi!
public class Person {
@Inject
public Person(){
this.name = "defaultname";
}
@Inject
public Person(String name){
this.name = name;
}
These @Inject annotations should be removed from all constructors. Why did
you add them? Person is not a service and @Inject is used for service
dependency injections.
@Inject
public Person(long id, String name, String phone, Date
dateOfBirth, int zip){
this.id = id;
this.name = name;
this.phone = phone;
this.dateOfBirth = dateOfBirth;
this.zip = zip;
}
private long id;
private String name;
private String phone;
private Date dateOfBirth;
private int zip;
// public getters/setters
}
############################
The link in showAll page
<t:pagelink page="add">Add new person</t:pagelink>
##############################
Add.tml
<html t:type="layout" title="Add new person"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<t:beaneditform object="person"/>
</html>
##########################
Add.java
public class Add {
@Property
@Persist
private Person person;
@Inject
private DAO dao;
@OnEvent(value = "submit")
public Object save() {
dao.save(person);
return "person";
}
}
Thanks in advance ! !
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org