I have an domain object named User, in which it has a field called `account'. However, the User object only provide method getAccount(), but does not provide method setAccount(String account).
public class User{ private String account; public User(... String account, ...){ ... this.account = account; } ... public String getAccount(){ return this.account } public void setAccount(String account){ this.account = account; } ... } In the page object e.g. Register, in which I build a BeanModel using BeanModelSource.create(User.class, ...) I notice that in the condition that the User object doesn't contain setAccount(String) method. The web page diplay will throw an error if 1.) in the Register page object, BeanModel does not use `BeanModel.add("account",null).label("Account").sortable(false)' method to create account field. Error: aused by: java.lang.RuntimeException: Bean editor model for User does not contain a property named 'account'. Available properties: address, name, password, sex. at org.apache.tapestry5.internal.beaneditor.BeanModelImpl.get(BeanModelImpl.java:152) at org.apache.tapestry5.internal.beaneditor.BeanModelImpl.reorder(BeanModelImpl.java:213) at org.jecommerce.pages.Register.getRegisterModel(Register.java:75) at $PropertyConduit_123e89435d6.get($PropertyConduit_123e89435d6.java) at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) ... 91 more 2.) in the Register page object, BeanModel uses `BeanModel.add("account", null).label("Account").sortable(false)' method to create account field. This error will be thrown after clicking the beaneditform button Register (the display of beaneditform for the html web page Register.tml is correctly shown on the browser). Error: Caused by: java.lang.RuntimeException: Bean editor model for User already contains a property model for property 'account'. at org.apache.tapestry5.internal.beaneditor.BeanModelImpl.validateNewPropertyName(BeanModelImpl.java:87) at org.apache.tapestry5.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:128) at org.jecommerce.pages.Register.getRegisterModel(Register.java:74) at $PropertyConduit_123e8863958.get($PropertyConduit_123e8863958.java) at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) ... 74 more The Register class code snippet: public BeanModel getRegisterModel(){ model = beanModelSource.create(User.class, ...); model.exclude("page"); model.add("account", null).label("Account").sortable(false); // unmarked when in condition 2, but marked in condition 1 model.reorder("account", "password", "name", "sex", "address"); return model; } public SelectModel getGenders(){ return displayer.createGender(); } and Register.tml <t:beaneditform t:submitlabel="Register" t:object="user" t:remove="page" t:model="registerModel"> <t:parameter name="account"> <t:label for="Account"/> <t:textField t:id="account" t:model="user" t:value="user.account" t:validate="required,regexp"/> </t:parameter> <t:parameter name="name"> <t:label for="Name"/> <t:textField t:id="name" t:model="user" t:value="user.name" t:validate="required,minlength=5"/> </t:parameter> <t:parameter name="password"> <t:label for="Password"/> <t:passwordField t:id="password" t:model="user" t:value="user.password" t:validate="required,minlength=2"/> </t:parameter> <t:parameter name="sex"> <t:label for="Sex"/> <t:select t:id="sex" t:model="genders" t:value="user.sex" t:blankOption="never"/> </t:parameter> </t:beaneditform> What is the correct way to add a column that the User object doesn't provide get/set method at the same time? Or the only way to display the field e.g account using BeanModel is to provide both get/set method in the domain object e.g. User? Thanks for the help. -- View this message in context: http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25531292.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org