I'm not sure what all of those @Inject's are for, and I'd recommend avoiding
@Persist wherever possible. Have a look at this example for ideas:
T5.4:
http://jumpstart.doublenegative.com.au/jumpstart7/together/easycrud/person/create
T5.3:
http://jumpstart.doublenegative.com.au/jumpstart/together/easycrud/person/create
Cheers,
Geoff
On 25 Jan 2015, at 7:33 pm, Cheng Zhang <[email protected]> wrote:
> Hi All,
>
> I was trying to create a new page for adding new person to existing
> person array. In the showAll page there is a link to this new page
> which I put BeanEditForm in it.
> I always get below error when I click the link.
>
> Render queue error in SetupRender[Add:beaneditform.editor]: Exception
> instantiating instance of com.homeone.quickstart.model.Person (for
> component 'Add:beaneditform.editor'):
> org.apache.tapestry5.ioc.internal.OperationException: No service
> implements the interface long.
>
>
> Put my code here:
> ###########
> Person,java
>
> public class Person {
> @Inject
> public Person(){
> this.name = "defaultname";
> }
>
> @Inject
> public Person(String name){
> this.name = name;
> }
>
> @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: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]