Re: beaneditform question
Hi, thanks. I managed to change the code and now it's working with a normal form component. On Tue, Nov 10, 2009 at 1:21 AM, DH ningd...@gmail.com wrote: I never had this issue before. I just test and everything works right, can you share the whole stack trace? DH http://www.gaonline.com.cn - Original Message - From: Jonhy Pear To: Tapestry users users@tapestry.apache.org Sent: Tuesday, November 10, 2009 3:27 AM Subject: Re: beaneditform question I'm experimenting your code but I'm blocked :( I have in my page.java @Property private String password; @Property private String confirmPassword; in my tml: form t:id=userRegistrationForm t:type=beaneditform object=user add=password, confirmPassword exclude=id, active p:passsword t:label for=password / t:passwordfield t:id=password validate=required / /p:passsword p:confirmPassword t:label for=confirmPassword / t:passwordfield t:id=confirmPassword validate=required / /p:confirmPassword /form But I get this error: Render queue error in BeginRender[user/New:userregistrationform.editor.propertyeditor]: The data type for property 'password' of org.code.sandbox.model.u...@d9973a is null. * * *Can you help me?* On Mon, Nov 9, 2009 at 4:13 PM, ningdh ningd...@gmail.com wrote: I am sorry that Object onValidate should be Object onValidateForm. DH - Original Message - From: João Pereira To: Tapestry users users@tapestry.apache.org Sent: Monday, November 09, 2009 11:53 PM Subject: Re: beaneditform question Thank you. On Mon, Nov 9, 2009 at 1:50 AM, DH ningd...@gmail.com wrote: Hi Simple sample(t5.1): In tml: form t:id=regForm t:type=beaneditform object=user include=nick,firstName,lastName add=password,retypePassword p:password t:label for=password/ t:passwordfield t:id=password validate=required /p:password p:retypePassword t:label for=retypePassword/ t:passwordfield t:id=retypePassword validate=required /p:retypePassword /form In java: @Component private BeanEditForm regForm; @Property private User user; // your user entity @Property private String password; @Property private String retypePassword; Object onValidate() { if (!password.equals(retypePassword)) { regForm.recordError(password and retypepassword must be == ); return this; // meaning validation failed } return null; // validation successfully. } Object onSuccess() { user.setPassword(encodeutil.encode(password)); service.save(user); return successpage or other; } DH http://www.gaonline.com.cn
Re: beaneditform question
Thank you. On Mon, Nov 9, 2009 at 1:50 AM, DH ningd...@gmail.com wrote: Hi Simple sample(t5.1): In tml: form t:id=regForm t:type=beaneditform object=user include=nick,firstName,lastName add=password,retypePassword p:password t:label for=password/ t:passwordfield t:id=password validate=required /p:password p:retypePassword t:label for=retypePassword/ t:passwordfield t:id=retypePassword validate=required /p:retypePassword /form In java: @Component private BeanEditForm regForm; @Property private User user; // your user entity @Property private String password; @Property private String retypePassword; Object onValidate() { if (!password.equals(retypePassword)) { regForm.recordError(password and retypepassword must be == ); return this; // meaning validation failed } return null; // validation successfully. } Object onSuccess() { user.setPassword(encodeutil.encode(password)); service.save(user); return successpage or other; } DH http://www.gaonline.com.cn - Original Message - From: Jonhy Pear To: users@tapestry.apache.org Sent: Monday, November 09, 2009 9:21 AM Subject: Re: beaneditform question Sorry, I mean beaneditform, not beaneditform On Mon, Nov 9, 2009 at 1:05 AM, Jonhy Pear jonhy.p...@gmail.com wrote: Hello all, This is my first message to the list. I'm new to tapestry and I'm evaluating it and looking for some guidance. Let's say I have a java bean with: String nick; String firstName; String lastName; String hashPassword; I want to use beaneditform to create a new user but I want to add new fields: password retypePassword and validade the presence of both and their equality. You know, that typical registration process. When user submit the new data I want to validate the equality of both password and confirmPassword and set a hash based on password in the field hashPassword in the bean. Does anybody have a sample code that I can use to know what is the best way to achieve this with tapestry? thank you -- João Miguel Pereira http://jpereira.eu LinkedIn: http://www.linkedin.com/in/joaomiguelpereira joaomiguel.pere...@gmail.com (351) 96 275 68 58 -- João Miguel Pereira http://jpereira.eu LinkedIn: http://www.linkedin.com/in/joaomiguelpereira joaomiguel.pere...@gmail.com (351) 96 275 68 58
Re: beaneditform question
I am sorry that Object onValidate should be Object onValidateForm. DH - Original Message - From: João Pereira To: Tapestry users users@tapestry.apache.org Sent: Monday, November 09, 2009 11:53 PM Subject: Re: beaneditform question Thank you. On Mon, Nov 9, 2009 at 1:50 AM, DH ningd...@gmail.com wrote: Hi Simple sample(t5.1): In tml: form t:id=regForm t:type=beaneditform object=user include=nick,firstName,lastName add=password,retypePassword p:password t:label for=password/ t:passwordfield t:id=password validate=required /p:password p:retypePassword t:label for=retypePassword/ t:passwordfield t:id=retypePassword validate=required /p:retypePassword /form In java: @Component private BeanEditForm regForm; @Property private User user; // your user entity @Property private String password; @Property private String retypePassword; Object onValidate() { if (!password.equals(retypePassword)) { regForm.recordError(password and retypepassword must be == ); return this; // meaning validation failed } return null; // validation successfully. } Object onSuccess() { user.setPassword(encodeutil.encode(password)); service.save(user); return successpage or other; } DH http://www.gaonline.com.cn
Re: beaneditform question
I'm experimenting your code but I'm blocked :( I have in my page.java @Property private String password; @Property private String confirmPassword; in my tml: form t:id=userRegistrationForm t:type=beaneditform object=user add=password, confirmPassword exclude=id, active p:passsword t:label for=password / t:passwordfield t:id=password validate=required / /p:passsword p:confirmPassword t:label for=confirmPassword / t:passwordfield t:id=confirmPassword validate=required / /p:confirmPassword /form But I get this error: Render queue error in BeginRender[user/New:userregistrationform.editor.propertyeditor]: The data type for property 'password' of org.code.sandbox.model.u...@d9973a is null. * * *Can you help me?* On Mon, Nov 9, 2009 at 4:13 PM, ningdh ningd...@gmail.com wrote: I am sorry that Object onValidate should be Object onValidateForm. DH - Original Message - From: João Pereira To: Tapestry users users@tapestry.apache.org Sent: Monday, November 09, 2009 11:53 PM Subject: Re: beaneditform question Thank you. On Mon, Nov 9, 2009 at 1:50 AM, DH ningd...@gmail.com wrote: Hi Simple sample(t5.1): In tml: form t:id=regForm t:type=beaneditform object=user include=nick,firstName,lastName add=password,retypePassword p:password t:label for=password/ t:passwordfield t:id=password validate=required /p:password p:retypePassword t:label for=retypePassword/ t:passwordfield t:id=retypePassword validate=required /p:retypePassword /form In java: @Component private BeanEditForm regForm; @Property private User user; // your user entity @Property private String password; @Property private String retypePassword; Object onValidate() { if (!password.equals(retypePassword)) { regForm.recordError(password and retypepassword must be == ); return this; // meaning validation failed } return null; // validation successfully. } Object onSuccess() { user.setPassword(encodeutil.encode(password)); service.save(user); return successpage or other; } DH http://www.gaonline.com.cn
Re: beaneditform question
I never had this issue before. I just test and everything works right, can you share the whole stack trace? DH http://www.gaonline.com.cn - Original Message - From: Jonhy Pear To: Tapestry users users@tapestry.apache.org Sent: Tuesday, November 10, 2009 3:27 AM Subject: Re: beaneditform question I'm experimenting your code but I'm blocked :( I have in my page.java @Property private String password; @Property private String confirmPassword; in my tml: form t:id=userRegistrationForm t:type=beaneditform object=user add=password, confirmPassword exclude=id, active p:passsword t:label for=password / t:passwordfield t:id=password validate=required / /p:passsword p:confirmPassword t:label for=confirmPassword / t:passwordfield t:id=confirmPassword validate=required / /p:confirmPassword /form But I get this error: Render queue error in BeginRender[user/New:userregistrationform.editor.propertyeditor]: The data type for property 'password' of org.code.sandbox.model.u...@d9973a is null. * * *Can you help me?* On Mon, Nov 9, 2009 at 4:13 PM, ningdh ningd...@gmail.com wrote: I am sorry that Object onValidate should be Object onValidateForm. DH - Original Message - From: João Pereira To: Tapestry users users@tapestry.apache.org Sent: Monday, November 09, 2009 11:53 PM Subject: Re: beaneditform question Thank you. On Mon, Nov 9, 2009 at 1:50 AM, DH ningd...@gmail.com wrote: Hi Simple sample(t5.1): In tml: form t:id=regForm t:type=beaneditform object=user include=nick,firstName,lastName add=password,retypePassword p:password t:label for=password/ t:passwordfield t:id=password validate=required /p:password p:retypePassword t:label for=retypePassword/ t:passwordfield t:id=retypePassword validate=required /p:retypePassword /form In java: @Component private BeanEditForm regForm; @Property private User user; // your user entity @Property private String password; @Property private String retypePassword; Object onValidate() { if (!password.equals(retypePassword)) { regForm.recordError(password and retypepassword must be == ); return this; // meaning validation failed } return null; // validation successfully. } Object onSuccess() { user.setPassword(encodeutil.encode(password)); service.save(user); return successpage or other; } DH http://www.gaonline.com.cn
Re: beaneditform question
Sorry, I mean beaneditform, not beaneditform On Mon, Nov 9, 2009 at 1:05 AM, Jonhy Pear jonhy.p...@gmail.com wrote: Hello all, This is my first message to the list. I'm new to tapestry and I'm evaluating it and looking for some guidance. Let's say I have a java bean with: String nick; String firstName; String lastName; String hashPassword; I want to use beaneditform to create a new user but I want to add new fields: password retypePassword and validade the presence of both and their equality. You know, that typical registration process. When user submit the new data I want to validate the equality of both password and confirmPassword and set a hash based on password in the field hashPassword in the bean. Does anybody have a sample code that I can use to know what is the best way to achieve this with tapestry? thank you -- João Miguel Pereira http://jpereira.eu LinkedIn: http://www.linkedin.com/in/joaomiguelpereira joaomiguel.pere...@gmail.com (351) 96 275 68 58
Re: beaneditform question
Hi Simple sample(t5.1): In tml: form t:id=regForm t:type=beaneditform object=user include=nick,firstName,lastName add=password,retypePassword p:password t:label for=password/ t:passwordfield t:id=password validate=required /p:password p:retypePassword t:label for=retypePassword/ t:passwordfield t:id=retypePassword validate=required /p:retypePassword /form In java: @Component private BeanEditForm regForm; @Property private User user; // your user entity @Property private String password; @Property private String retypePassword; Object onValidate() { if (!password.equals(retypePassword)) { regForm.recordError(password and retypepassword must be == ); return this; // meaning validation failed } return null; // validation successfully. } Object onSuccess() { user.setPassword(encodeutil.encode(password)); service.save(user); return successpage or other; } DH http://www.gaonline.com.cn - Original Message - From: Jonhy Pear To: users@tapestry.apache.org Sent: Monday, November 09, 2009 9:21 AM Subject: Re: beaneditform question Sorry, I mean beaneditform, not beaneditform On Mon, Nov 9, 2009 at 1:05 AM, Jonhy Pear jonhy.p...@gmail.com wrote: Hello all, This is my first message to the list. I'm new to tapestry and I'm evaluating it and looking for some guidance. Let's say I have a java bean with: String nick; String firstName; String lastName; String hashPassword; I want to use beaneditform to create a new user but I want to add new fields: password retypePassword and validade the presence of both and their equality. You know, that typical registration process. When user submit the new data I want to validate the equality of both password and confirmPassword and set a hash based on password in the field hashPassword in the bean. Does anybody have a sample code that I can use to know what is the best way to achieve this with tapestry? thank you -- João Miguel Pereira http://jpereira.eu LinkedIn: http://www.linkedin.com/in/joaomiguelpereira joaomiguel.pere...@gmail.com (351) 96 275 68 58
Re: Add a column to beaneditform question
The tml is t:beaneditform submitlabel=Register object=user remove=page 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 and page object contains @Inject private ModelCreator displayer; @Property @Retain private BeanModel model; @Property private User user; ... public BeanModel getRegisterModel(){ // change to pass in from ui (let user choose from ui) String lang = Locale.ENGLISH.getDisplayLanguage(); String country = Locale.US.getDisplayCountry(); model = displayer.createBeanModel(User.class, lang, country); model.add(account, null).label(Account).sortable(false); return model; } public SelectModel getGenders(){ return displayer.createGender(); } in ModelCreator.java public BeanModel createBeanModel(Class clazz, String lang, String country){ if(null == source) throw new NullPointerException(No BeanModelSource configured!); if(null == cache.get(BeanModel.class)){ ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(messages_en_US.properties); String path = url.getPath(); BeanModel model = null; try{ ResourceBundle bundle = new PropertyResourceBundle(new FileInputStream(path)); model = source.create( clazz, true, new MessagesImpl(new Locale(lang, country), bundle) ); }catch(IOException ioe){ ioe.printStackTrace(); } cache.put(BeanModel.class, model); } return (BeanModel)cache.get(BeanModel.class); } Thiago H. de Paula Figueiredo wrote: Please post your template. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor Consultor, desenvolvedor e instrutor em Java Coordenador e professor da Especialização em Engenharia de Software com Ênfase em Java da Faculdade Pitágoras http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- View this message in context: http://www.nabble.com/Add-a-column-to-beaneditform-question-tp25477600p25530611.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
Re: Add a column to beaneditform question
result in error: @Property(write=false) @Retain private BeanModel model; work version: @Property @Retain private BeanModel model; I sovle this problem. The problem comes from the above annotation where there is an attribute named `write' that should be removed (I thought it was removed but indeed it was not) so that the bean model can add new column. Thanks for the help. I appreciate it. -- View this message in context: http://www.nabble.com/Add-a-column-to-beaneditform-question-tp25477600p25530674.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
Add a column to beaneditform question
I have an user object which contains several properties, including account, name, gender and password. However, due to the object only provide getAccount() method. So when displaying using beaneditform, the web page does not show the Account column. Then I search the forum http://www.nabble.com/-T5--How-to-add-a-extra-column-for-delete-update-action-using-Grid-component.-td12255655.html#a12258689 http://www.nabble.com/T5-%3A-Rendering-one-column-in-Grid-compoenent-made-the-paging-disappeared---td14565259.html#a14565259 and add the following lines to create a column called Account after using beanModel to create required BeanModel. model = beanModelSource.create(User.class, ...); model.add(account, null).label(Account).sortable(false); Unfortunately, after compilation and deployment, the web page still do not show the column Account. Is this the right way to add a new column to beaneditform? Or what is the correct way to achieve such purpose? I appreciate any suggestion, Thank you. -- View this message in context: http://www.nabble.com/Add-a-column-to-beaneditform-question-tp25477600p25477600.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
Re: Add a column to beaneditform question
Please post your template. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor Consultor, desenvolvedor e instrutor em Java Coordenador e professor da Especialização em Engenharia de Software com Ênfase em Java da Faculdade Pitágoras http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org