You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by 滕训华 <te...@magic-sw.com.cn> on 2008/06/13 05:25:08 UTC
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???
RE: Question About BeanEditForm
Posted by Kristian Marinkovic <kr...@porsche.co.at>.
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
滕训华 <te...@magic-sw.com.cn>
13.06.2008 05:25
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>
An
"'Tapestry users'" <us...@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???