correct... the BeanEditForm requires that the bean has a 
no-arg constructor. If your bean is null the BeanEditForm 
will instantiate the bean for you. when you don't have a no-arg
constructor the component cannot know what data to use to 
instantiate it. 

BTW. Hibernate also requires that your entities have at least 
a no-arg constructor.

g,
kris




滕训华 <[EMAIL PROTECTED]> 
13.06.2008 05:25
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
"'Tapestry users'" <users@tapestry.apache.org>
Kopie

Thema
Question About BeanEditForm






When I put a beanEditForm component in my tml file as following:

 

<t:beaneditform t:id="customer" submitlabel="message:create-user"/>

 

And in page class 

 

 

public class EditCustomer {

    @Persist

    private TblMenuItem customer;

 

    public TblMenuItem getCustomer() {

       return customer;

    }

 

    public void setCustomer(TblMenuItem customer) {

       this.customer = customer;

    }

 

 

}

 

But I found it has a error if there has other constructor in TblMenuItem 
as
following:

 

    public TblMenuItem(long menuId, String menuName, String menuLink,

           String executeRoles) {

       this.menuId = menuId;

       this.menuName = menuName;

       this.menuLink = menuLink;

       this.executeRoles = executeRoles;

    }

 

And the error is:

 


    An unexpected application exception has occurred.


Render queue error in SetupRender[EditCustomer:customer.editor]: Exception
instantiating instance of com.callcenter.model.TblMenuItem (for component
'EditCustomer:customer.editor'): Error invoking constructor
com.callcenter.model.TblMenuItem(long, String, String, String) (at
TblMenuItem.java:24) (for service 'BeanModelSource'): No service 
implements
the interface long.

 

If I remove the class constructor it will be correct.I should not have
other constructor except default constructor???

 

 



Reply via email to