Hi Geoff, Thanks for responding. I removed the @Persist but does not help.
I have another project with almost same code working well. I found the difference is, in that project, the create page's java import org.apache.tapestry.ioc.annotations.Inject rather than org.apache.tapestry5.ioc.annotations.Inject in my current project. I guess this may be the reason because the error is org.apache.tapestry5.ioc.internal.OperationException. I commented the import tapestry5, added a tapestry-ioc-5.0.7.jar into build path by using Eclipse's "fix project setup". Then import org.apache.tapestry.ioc.annotations.Inject, now this project has the same setting with another project. However Maven build shows Compilation failure: [ERROR] \Users\Cheng\OneDrive\Eclipse_Workspace\quickstart\src\main\java\com\homeone\quickstart\pages\Add.java:[3,42] error: package org.apache.tapestry.ioc.annotations does not exist the 3rd line of Add.java is the import line. In fact I added this import by using the Eclipse hint function rather than typing or copying/pasting them. The jumpstart uses EJB rather than Tapestry ioc, so @Inject is not used. Thanks in advance. Cheng On Sun, Jan 25, 2015 at 4:59 PM, Geoff Callender <[email protected]> wrote: > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
