Re: T5: @Validate on RadioGroup
Thanks Taha, but I did supply @Validate(required) annotation and validation did not happen. Adam On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi I compared the code from RadioGroup with that of Select and found the following difference In Select if parameter 'validate' is not given a default is chosen and so it is never null. Validation is performed in processSubmission() method by the line fieldValidationSupport.validate(selectedValue, resources, validate); In RadioGroup however, there is no defaultValidate(){} and so validate can be null. Now the validation here is done by the line if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); so when the validate parameter is not supplied, validation does not happen. regards Taha On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski zimowsk...@gmail.com wrote: I have a bean where @Validate(required) does not work on a radiogroup, but t:radiogroup validate=required ... does. Other @Validate annotated fields (TextField's) work. My companyType is purposely set to null by default, as I do not want any radio pre-selected, thus it shall be required. Is @Validate in the context I have defined supposed to work on the radio group as well? /** * @author Adam Zimowski */ public class RegisterUiBean { @Validate(required) private String email; @Validate(required) private String emailRetype; @Validate(required) private String password; @Validate(required) private String passwordRetype; @Validate(required) private CompanyType companyType; public RegisterUiBean() { } public String getEmail() { return email; } public void setEmail(String aEmail) { email = aEmail; } public String getEmailRetype() { return emailRetype; } public void setEmailRetype(String aEmailRetype) { emailRetype = aEmailRetype; } public String getPassword() { return password; } public void setPassword(String aPassword) { password = aPassword; } public String getPasswordRetype() { return passwordRetype; } public void setPasswordRetype(String aPasswordRetype) { passwordRetype = aPasswordRetype; } public CompanyType getCompanyType() { return companyType; } public void setCompanyType(CompanyType aCompanyType) { companyType = aCompanyType; } public CompanyType getCorporation() { return CompanyType.Corporation; } public CompanyType getFederalGov() { return CompanyType.FederalGovernment; } public CompanyType getStateGov() { return CompanyType.StateGovernment; } public CompanyType getIndividual() { return CompanyType.Individual; } } div class=kk-hdrRegistration Information/div div class=kk-row div class=kk-labelt:label for=r_email1/ :/div div class=kk-fieldt:textfield t:id=r_email1 value=registration.email//div t:error class=literal:kk-error for=r_email1/ /div div class=kk-row div class=kk-labelt:label for=r_email2/ :/div div class=kk-fieldt:textfield t:id=r_email2 value=registration.emailRetype//div t:error class=literal:kk-error for=r_email2/ /div div class=kk-row div class=kk-labelt:label for=r_pass1/ :/div div class=kk-fieldt:textfield t:id=r_pass1 value=registration.password//div t:error class=literal:kk-error for=r_pass1/ /div div class=kk-row div class=kk-labelt:label for=r_pass2/ :/div div class=kk-fieldt:textfield t:id=r_pass2 value=registration.passwordRetype//div t:error class=literal:kk-error for=r_pass2/ /div div class=kk-row div class=kk-labelt:label for=r_type/ :/div div class=kk-field t:radiogroup t:id=r_type value=registration.companyType validate=required t:radio t:id=corporation value=registration.corporation/ t:label for=corporation/ t:radio t:id=federalGovernment value=registration.federalGov/ t:label for=federalGovernment/ t:radio t:id=stateGovernment value=registration.stateGov/ t:label for=stateGovernment/ t:radio t:id=individual value=registration.individual/ t:label for=individual/ /t:radiogroup /div Adam - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: @Validate on RadioGroup
it is the @Parameter validate in RadioGroup that is required not @Validate as that is never checked in case @Parameter validate is not given in a RadioGroup ... Please read my answer again :) It seems to be bug!! regards Taha On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski zimowsk...@gmail.com wrote: Thanks Taha, but I did supply @Validate(required) annotation and validation did not happen. Adam On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi I compared the code from RadioGroup with that of Select and found the following difference In Select if parameter 'validate' is not given a default is chosen and so it is never null. Validation is performed in processSubmission() method by the line fieldValidationSupport.validate(selectedValue, resources, validate); In RadioGroup however, there is no defaultValidate(){} and so validate can be null. Now the validation here is done by the line if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); so when the validate parameter is not supplied, validation does not happen. regards Taha On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski zimowsk...@gmail.com wrote: I have a bean where @Validate(required) does not work on a radiogroup, but t:radiogroup validate=required ... does. Other @Validate annotated fields (TextField's) work. My companyType is purposely set to null by default, as I do not want any radio pre-selected, thus it shall be required. Is @Validate in the context I have defined supposed to work on the radio group as well? /** * @author Adam Zimowski */ public class RegisterUiBean { @Validate(required) private String email; @Validate(required) private String emailRetype; @Validate(required) private String password; @Validate(required) private String passwordRetype; @Validate(required) private CompanyType companyType; public RegisterUiBean() { } public String getEmail() { return email; } public void setEmail(String aEmail) { email = aEmail; } public String getEmailRetype() { return emailRetype; } public void setEmailRetype(String aEmailRetype) { emailRetype = aEmailRetype; } public String getPassword() { return password; } public void setPassword(String aPassword) { password = aPassword; } public String getPasswordRetype() { return passwordRetype; } public void setPasswordRetype(String aPasswordRetype) { passwordRetype = aPasswordRetype; } public CompanyType getCompanyType() { return companyType; } public void setCompanyType(CompanyType aCompanyType) { companyType = aCompanyType; } public CompanyType getCorporation() { return CompanyType.Corporation; } public CompanyType getFederalGov() { return CompanyType.FederalGovernment; } public CompanyType getStateGov() { return CompanyType.StateGovernment; } public CompanyType getIndividual() { return CompanyType.Individual; } } div class=kk-hdrRegistration Information/div div class=kk-row div class=kk-labelt:label for=r_email1/ :/div div class=kk-fieldt:textfield t:id=r_email1 value=registration.email//div t:error class=literal:kk-error for=r_email1/ /div div class=kk-row div class=kk-labelt:label for=r_email2/ :/div div class=kk-fieldt:textfield t:id=r_email2 value=registration.emailRetype//div t:error class=literal:kk-error for=r_email2/ /div div class=kk-row div class=kk-labelt:label for=r_pass1/ :/div div class=kk-fieldt:textfield t:id=r_pass1 value=registration.password//div t:error class=literal:kk-error for=r_pass1/ /div div class=kk-row div class=kk-labelt:label for=r_pass2/ :/div div class=kk-fieldt:textfield t:id=r_pass2 value=registration.passwordRetype//div t:error class=literal:kk-error for=r_pass2/ /div div class=kk-row div class=kk-labelt:label for=r_type/ :/div div class=kk-field t:radiogroup t:id=r_type value=registration.companyType validate=required t:radio t:id=corporation value=registration.corporation/ t:label for=corporation/ t:radio t:id=federalGovernment value=registration.federalGov/ t:label for=federalGovernment/ t:radio t:id=stateGovernment value=registration.stateGov/ t:label for=stateGovernment/ t:radio t:id=individual
T5: Select wont find selected value in edit?
Hi I have a problem when I am trying to edit values that the selected value does not appear? My code is below and I thought you just put into value=team.keeper which would return the keeper. The two classes both have @Property+@Persist annotations. tml for edit class: insert for creating the values Work method is a regex which replaces part of the string value: String statement = INSERT INTO teams(goalkeeper) VALUES(?); prep = conn.prepareStatement(statement); team = new Team(); prep.setString(1, work(keeper)); team.setKeeper(keeper); prep.executeUpdate(); return index; Any help is greatly appreciated as always.. Cheers -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300292.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: T5: @Validate on RadioGroup
Hi Taha - I agree with you it seems to be a bug, and I (think) I get what you are saying. However, I am having a hard time seeing why the bug would be in RadioGroup processSubmission() or anywhere in the RadioGroup class for that matter. Rather, it seems the bug (if exists) is deeper in the chain, where the @Validate annotation is read off of a bean and applied to a RadioGroup. I believe this because RadioGroup *does* behave correctly if TML defines: t:radiogroup validate=required but now when the @Validate(required) is on the bean. Adam On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: it is the @Parameter validate in RadioGroup that is required not @Validate as that is never checked in case @Parameter validate is not given in a RadioGroup ... Please read my answer again :) It seems to be bug!! regards Taha On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski zimowsk...@gmail.com wrote: Thanks Taha, but I did supply @Validate(required) annotation and validation did not happen. Adam On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi I compared the code from RadioGroup with that of Select and found the following difference In Select if parameter 'validate' is not given a default is chosen and so it is never null. Validation is performed in processSubmission() method by the line fieldValidationSupport.validate(selectedValue, resources, validate); In RadioGroup however, there is no defaultValidate(){} and so validate can be null. Now the validation here is done by the line if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); so when the validate parameter is not supplied, validation does not happen. regards Taha On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski zimowsk...@gmail.com wrote: I have a bean where @Validate(required) does not work on a radiogroup, but t:radiogroup validate=required ... does. Other @Validate annotated fields (TextField's) work. My companyType is purposely set to null by default, as I do not want any radio pre-selected, thus it shall be required. Is @Validate in the context I have defined supposed to work on the radio group as well? /** * @author Adam Zimowski */ public class RegisterUiBean { @Validate(required) private String email; @Validate(required) private String emailRetype; @Validate(required) private String password; @Validate(required) private String passwordRetype; @Validate(required) private CompanyType companyType; public RegisterUiBean() { } public String getEmail() { return email; } public void setEmail(String aEmail) { email = aEmail; } public String getEmailRetype() { return emailRetype; } public void setEmailRetype(String aEmailRetype) { emailRetype = aEmailRetype; } public String getPassword() { return password; } public void setPassword(String aPassword) { password = aPassword; } public String getPasswordRetype() { return passwordRetype; } public void setPasswordRetype(String aPasswordRetype) { passwordRetype = aPasswordRetype; } public CompanyType getCompanyType() { return companyType; } public void setCompanyType(CompanyType aCompanyType) { companyType = aCompanyType; } public CompanyType getCorporation() { return CompanyType.Corporation; } public CompanyType getFederalGov() { return CompanyType.FederalGovernment; } public CompanyType getStateGov() { return CompanyType.StateGovernment; } public CompanyType getIndividual() { return CompanyType.Individual; } } div class=kk-hdrRegistration Information/div div class=kk-row div class=kk-labelt:label for=r_email1/ :/div div class=kk-fieldt:textfield t:id=r_email1 value=registration.email//div t:error class=literal:kk-error for=r_email1/ /div div class=kk-row div class=kk-labelt:label for=r_email2/ :/div div class=kk-fieldt:textfield t:id=r_email2 value=registration.emailRetype//div t:error class=literal:kk-error for=r_email2/ /div div class=kk-row div class=kk-labelt:label for=r_pass1/ :/div div class=kk-fieldt:textfield t:id=r_pass1 value=registration.password//div t:error class=literal:kk-error for=r_pass1/ /div div class=kk-row div class=kk-labelt:label for=r_pass2/ :/div div class=kk-fieldt:textfield
Re: T5: Select wont find selected value in edit?
no .tml here On Wed, 2011-04-13 at 03:41 -0700, robnangle wrote: Hi I have a problem when I am trying to edit values that the selected value does not appear? My code is below and I thought you just put into value=team.keeper which would return the keeper. The two classes both have @Property+@Persist annotations. tml for edit class: insert for creating the values Work method is a regex which replaces part of the string value: String statement = INSERT INTO teams(goalkeeper) VALUES(?); prep = conn.prepareStatement(statement); team = new Team(); prep.setString(1, work(keeper)); team.setKeeper(keeper); prep.executeUpdate(); return index; Any help is greatly appreciated as always.. Cheers -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300292.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: @Validate on RadioGroup
You are still not getting the point... 1. fieldValidationSupport,validate is the service responsible for validating a field. It requries a FieldValidator which is passed as a parameter to it. If this @Parameter validate is null, as is the case with RadioGroup, fieldValidationSupport is never called as the source shows if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); 2. In other components like Select, if @Parameter validate is not provided a default is chosen. The default is provided by ComponentDefaultProvider which in turn calls FieldValidatorDefaultProvider which uses FieldValidatorSource for creating default validators based on the field annotations and type. in case of Select we have default validate like this Binding defaultValidate() { return defaultProvider.defaultValidatorBinding(value, resources); } so if we don't provide a validate, the default is chosen Now in a RadioGroup as the code does not use a default in case @Parameter validate is not provided, the field annotations are not taken into consideration regards Taha On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski zimowsk...@gmail.com wrote: Hi Taha - I agree with you it seems to be a bug, and I (think) I get what you are saying. However, I am having a hard time seeing why the bug would be in RadioGroup processSubmission() or anywhere in the RadioGroup class for that matter. Rather, it seems the bug (if exists) is deeper in the chain, where the @Validate annotation is read off of a bean and applied to a RadioGroup. I believe this because RadioGroup *does* behave correctly if TML defines: t:radiogroup validate=required but now when the @Validate(required) is on the bean. Adam On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: it is the @Parameter validate in RadioGroup that is required not @Validate as that is never checked in case @Parameter validate is not given in a RadioGroup ... Please read my answer again :) It seems to be bug!! regards Taha On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski zimowsk...@gmail.com wrote: Thanks Taha, but I did supply @Validate(required) annotation and validation did not happen. Adam On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi I compared the code from RadioGroup with that of Select and found the following difference In Select if parameter 'validate' is not given a default is chosen and so it is never null. Validation is performed in processSubmission() method by the line fieldValidationSupport.validate(selectedValue, resources, validate); In RadioGroup however, there is no defaultValidate(){} and so validate can be null. Now the validation here is done by the line if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); so when the validate parameter is not supplied, validation does not happen. regards Taha On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski zimowsk...@gmail.com wrote: I have a bean where @Validate(required) does not work on a radiogroup, but t:radiogroup validate=required ... does. Other @Validate annotated fields (TextField's) work. My companyType is purposely set to null by default, as I do not want any radio pre-selected, thus it shall be required. Is @Validate in the context I have defined supposed to work on the radio group as well? /** * @author Adam Zimowski */ public class RegisterUiBean { @Validate(required) private String email; @Validate(required) private String emailRetype; @Validate(required) private String password; @Validate(required) private String passwordRetype; @Validate(required) private CompanyType companyType; public RegisterUiBean() { } public String getEmail() { return email; } public void setEmail(String aEmail) { email = aEmail; } public String getEmailRetype() { return emailRetype; } public void setEmailRetype(String aEmailRetype) { emailRetype = aEmailRetype; } public String getPassword() { return password; } public void setPassword(String aPassword) { password = aPassword; } public String getPasswordRetype() { return passwordRetype; } public void setPasswordRetype(String aPasswordRetype) { passwordRetype = aPasswordRetype; } public CompanyType getCompanyType() { return companyType; }
Re: T5: Select wont find selected value in edit?
t:select t:id=goalkeeper model=goalkeepers value=team.keeper blankOption=never/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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: T5: Select wont find selected value in edit?
the value attribute will set (choose) the drop down value from the options defined in goalkeepers. Does this option/value exist in your model? On Wed, 2011-04-13 at 04:30 -0700, robnangle wrote: t:select t:id=goalkeeper model=goalkeepers value=team.keeper blankOption=never/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Select wont find selected value in edit?
Richard Hill-7 wrote: the value attribute will set (choose) the drop down value from the options defined in goalkeepers. Does this option/value exist in your model? On Wed, 2011-04-13 at 04:30 -0700, robnangle wrote: t:select t:id=goalkeeper model=goalkeepers value=team.keeper blankOption=never/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org It does yes, its just a list of all the goalkeepers so there is no way that one is missng. It seems to be saying the keeper property is null in the edit class, but that shouldn't be as its beeing set when a user creates it in the add class? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300371.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: T5: Select wont find selected value in edit?
are add and edit page classes? If you instantiate an object in one page it won't be set in another, unless you persist as an SSO @Persist is only scoped to a particular page, i.e saves values between requests. An @Persist'd object is not visible to other pages. On Wed, 2011-04-13 at 04:41 -0700, robnangle wrote: Richard Hill-7 wrote: the value attribute will set (choose) the drop down value from the options defined in goalkeepers. Does this option/value exist in your model? On Wed, 2011-04-13 at 04:30 -0700, robnangle wrote: t:select t:id=goalkeeper model=goalkeepers value=team.keeper blankOption=never/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300356.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org It does yes, its just a list of all the goalkeepers so there is no way that one is missng. It seems to be saying the keeper property is null in the edit class, but that shouldn't be as its beeing set when a user creates it in the add class? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300371.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: @Validate on RadioGroup
Hi Taha, You are still not getting the point... Why so direct, having a bad day? Please tell me how am I not getting the point when I clearly wrote that: t:radiogroup validate=required Works. The validate parameter is not null with the above, and the Radio group works as expected, as shown in RadioGroup processSubmission(): if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); I think you are missing the point. I realized that validate parameter in RadioGroup is null when @Validate on the bean is present and so validation does not get triggered. If this is a bug, which we both seem to agree, rather than stating the obvious, I would be interested (due to lack of expertise in Tapestry) where in the source does Tapestry read a @Validate annotation off a bean field, and interprets it accordingly. The RadioGroup does not seem to be the problem, and the if statement it contains to test nullability of the validate parameter is not the issue, either. Regards, Adam On Wed, Apr 13, 2011 at 6:30 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: You are still not getting the point... 1. fieldValidationSupport,validate is the service responsible for validating a field. It requries a FieldValidator which is passed as a parameter to it. If this @Parameter validate is null, as is the case with RadioGroup, fieldValidationSupport is never called as the source shows if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); 2. In other components like Select, if @Parameter validate is not provided a default is chosen. The default is provided by ComponentDefaultProvider which in turn calls FieldValidatorDefaultProvider which uses FieldValidatorSource for creating default validators based on the field annotations and type. in case of Select we have default validate like this Binding defaultValidate() { return defaultProvider.defaultValidatorBinding(value, resources); } so if we don't provide a validate, the default is chosen Now in a RadioGroup as the code does not use a default in case @Parameter validate is not provided, the field annotations are not taken into consideration regards Taha On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski zimowsk...@gmail.com wrote: Hi Taha - I agree with you it seems to be a bug, and I (think) I get what you are saying. However, I am having a hard time seeing why the bug would be in RadioGroup processSubmission() or anywhere in the RadioGroup class for that matter. Rather, it seems the bug (if exists) is deeper in the chain, where the @Validate annotation is read off of a bean and applied to a RadioGroup. I believe this because RadioGroup *does* behave correctly if TML defines: t:radiogroup validate=required but now when the @Validate(required) is on the bean. Adam On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: it is the @Parameter validate in RadioGroup that is required not @Validate as that is never checked in case @Parameter validate is not given in a RadioGroup ... Please read my answer again :) It seems to be bug!! regards Taha On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski zimowsk...@gmail.com wrote: Thanks Taha, but I did supply @Validate(required) annotation and validation did not happen. Adam On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi I compared the code from RadioGroup with that of Select and found the following difference In Select if parameter 'validate' is not given a default is chosen and so it is never null. Validation is performed in processSubmission() method by the line fieldValidationSupport.validate(selectedValue, resources, validate); In RadioGroup however, there is no defaultValidate(){} and so validate can be null. Now the validation here is done by the line if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); so when the validate parameter is not supplied, validation does not happen. regards Taha On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski zimowsk...@gmail.com wrote: I have a bean where @Validate(required) does not work on a radiogroup, but t:radiogroup validate=required ... does. Other @Validate annotated fields (TextField's) work. My companyType is purposely set to null by default, as I do not want any radio pre-selected, thus it shall be required. Is @Validate in the context I have defined supposed to work on the radio group as well? /** * @author Adam Zimowski */ public class RegisterUiBean { @Validate(required) private String email; @Validate(required) private String emailRetype; @Validate(required) private String password; @Validate(required) private String
Re: T5: @Property(create=true) ?
And what if we allowed to create defaultXxx method for persistent fields as we do for component parameters, does it make sense ? 2011/4/12 Howard Lewis Ship hls...@gmail.com This wouldn't have to be an extension to the @Property annotation, it could be a new annotation, (say) @AutoCreate, perhaps with a value to say when (initialize, setup render, etc.). It could use the same kind of logic that the BeanEditForm uses, one that supports the full injection mechanism. On Tue, Apr 12, 2011 at 10:25 AM, Adam Zimowski zimowsk...@gmail.com wrote: You have a point Thiago, I will try other init phases, I suppose just a habit, and it worked :) In regards to your comment on page pool Now that Tap isn't using it, would auto create property instance be an issue? Just curious.. Adam On Tue, Apr 12, 2011 at 12:19 PM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: On Tue, 12 Apr 2011 13:34:17 -0300, Adam Zimowski zimowsk...@gmail.com wrote: Maybe I'm over-thinking here... I find a lot of times I have to do this: @Property private AddressUiBean address; @SetupRender void init() { if(address == null) address = new AddressUiBean(); } Why not activate instead of @SetupRender? Or one of the prepare* events of Form? Not an easy decision. ;) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: T5: Select wont find selected value in edit?
Richard Hill-7 wrote: are add and edit page classes? They are yes.. All values are @Persist, @Property So is the only way to get the default value up by setting all players as sso's? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300407.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: T5: Select wont find selected value in edit?
It depends. If you have a static list of players then you can store your select model in the session. If it's dynamic, you prob want to reload from the db each time. To be honest I'm not sure that storing stuff like this as an SSO is best-practice - it's more for user session state. And you want to limit what you store in the session anyway as it contributes to your application's overhead - small objects, primitive data types, not huge lists of complex objects. These should come from the db. Although a more experienced Tapestry dev can confirm. On Wed, 2011-04-13 at 04:56 -0700, robnangle wrote: Richard Hill-7 wrote: are add and edit page classes? They are yes.. All values are @Persist, @Property So is the only way to get the default value up by setting all players as sso's? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300407.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Select wont find selected value in edit?
Richard Hill-7 wrote: It depends. If you have a static list of players then you can store your select model in the session. If it's dynamic, you prob want to reload from the db each time. To be honest I'm not sure that storing stuff like this as an SSO is best-practice - it's more for user session state. And you want to limit what you store in the session anyway as it contributes to your application's overhead - small objects, primitive data types, not huge lists of complex objects. These should come from the db. Although a more experienced Tapestry dev can confirm. Yes thats what I thought. What is strange is that it works for editing user details? But wont for editing the team. Thats why I thought it was to do with the way im adding the team(keeper...). As i change the string value when adding it to the database. prep.setString(3, work(keeper)); // the work method changes the string to say 'Steven Gerrard' team.setKeeper(keeper); // this is the whole value 'Liverpool - Steven Gerrard' Does this changes things? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300442.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: T5: @Validate on RadioGroup
Hi Adam Hi Adam On Wed, Apr 13, 2011 at 5:19 PM, Adam Zimowski zimowsk...@gmail.com wrote: Hi Taha, You are still not getting the point... Why so direct, having a bad day? Please tell me how am I not getting the point when I clearly wrote that: Sorry if it appeared rude, that was certainly not my intention (In my defense, English is not my first language). I think it should have been you are missing the point :) t:radiogroup validate=required Works. The validate parameter is not null with the above, and the Radio group works as expected, as shown in RadioGroup processSubmission(): if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); I think you are missing the point. I realized that validate parameter in RadioGroup is null when @Validate on the bean is present and so validation does not get triggered. If this is a bug, which we both seem to agree, rather than stating the obvious, I would be interested (due to lack of expertise in Tapestry) where in the source does Tapestry read a @Validate annotation off a bean field, and interprets it accordingly. That I mentioned in my last mail The RadioGroup does not seem to be the problem, and the if statement it contains to test nullability of the validate parameter is not the issue, either. RadioGroup is the problem as it does not contain defaultValidate(){ return defaultProvider.defaultValidatorBinding(value, resources); } If it was there the defaultProvider(as I already mentioned in my previous mail) with indirectly take care of the case where validate @Parameter is null Regards, Adam Sorry again regards Taha On Wed, Apr 13, 2011 at 6:30 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: You are still not getting the point... 1. fieldValidationSupport,validate is the service responsible for validating a field. It requries a FieldValidator which is passed as a parameter to it. If this @Parameter validate is null, as is the case with RadioGroup, fieldValidationSupport is never called as the source shows if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); 2. In other components like Select, if @Parameter validate is not provided a default is chosen. The default is provided by ComponentDefaultProvider which in turn calls FieldValidatorDefaultProvider which uses FieldValidatorSource for creating default validators based on the field annotations and type. in case of Select we have default validate like this Binding defaultValidate() { return defaultProvider.defaultValidatorBinding(value, resources); } so if we don't provide a validate, the default is chosen Now in a RadioGroup as the code does not use a default in case @Parameter validate is not provided, the field annotations are not taken into consideration regards Taha On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski zimowsk...@gmail.com wrote: Hi Taha - I agree with you it seems to be a bug, and I (think) I get what you are saying. However, I am having a hard time seeing why the bug would be in RadioGroup processSubmission() or anywhere in the RadioGroup class for that matter. Rather, it seems the bug (if exists) is deeper in the chain, where the @Validate annotation is read off of a bean and applied to a RadioGroup. I believe this because RadioGroup *does* behave correctly if TML defines: t:radiogroup validate=required but now when the @Validate(required) is on the bean. Adam On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: it is the @Parameter validate in RadioGroup that is required not @Validate as that is never checked in case @Parameter validate is not given in a RadioGroup ... Please read my answer again :) It seems to be bug!! regards Taha On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski zimowsk...@gmail.com wrote: Thanks Taha, but I did supply @Validate(required) annotation and validation did not happen. Adam On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi I compared the code from RadioGroup with that of Select and found the following difference In Select if parameter 'validate' is not given a default is chosen and so it is never null. Validation is performed in processSubmission() method by the line fieldValidationSupport.validate(selectedValue, resources, validate); In RadioGroup however, there is no defaultValidate(){} and so validate can be null. Now the validation here is done by the line if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); so when the validate parameter is not supplied, validation does not happen. regards Taha On Wed, Apr 13, 2011 at 2:19 AM, Adam Zimowski
Re: T5: Select wont find selected value in edit?
On Wed, 13 Apr 2011 08:30:42 -0300, robnangle robnan...@gmail.com wrote: t:select t:id=goalkeeper model=goalkeepers value=team.keeper blankOption=never/ Make sure you overrode the equals() and hashCode() methods in the Goalkeeper class with a correct implementation. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Select wont find selected value in edit?
Thiago H. de Paula Figueiredo wrote: On Wed, 13 Apr 2011 08:30:42 -0300, robnangle lt;robnan...@gmail.comgt; wrote: t:select t:id=goalkeeper model=goalkeepers value=team.keeper blankOption=never/ Make sure you overrode the equals() and hashCode() methods in the Goalkeeper class with a correct implementation. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org There is no goalkeepers class, goalkeepers is just a list of players taken from the database: public List getGoalkeepers() { gsp = new GenerateSelectPlayers(); // class that generates the players from the db return gsp.getGoalkeepers(); } -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300475.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: T5: Select wont find selected value in edit?
On Wed, 13 Apr 2011 09:33:04 -0300, robnangle robnan...@gmail.com wrote: There is no goalkeepers class, goalkeepers is just a list of players taken from the database: public List getGoalkeepers() { gsp = new GenerateSelectPlayers(); // class that generates the players from the db return gsp.getGoalkeepers(); } Again: to make Select (and any operation in Java collections) work, the object type you're putting in the collection needs to have appropriate equals() and hashCode() methods. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Select wont find selected value in edit?
Thiago H. de Paula Figueiredo wrote: On Wed, 13 Apr 2011 09:33:04 -0300, robnangle lt;robnan...@gmail.comgt; wrote: There is no goalkeepers class, goalkeepers is just a list of players taken from the database: public List getGoalkeepers() { gsp = new GenerateSelectPlayers(); // class that generates the players from the db return gsp.getGoalkeepers(); } Again: to make Select (and any operation in Java collections) work, the object type you're putting in the collection needs to have appropriate equals() and hashCode() methods. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org Ok and this method should be in the getKeepers()? What do i check if its equal to? Apologies for what probably are stupid questions, I just hevnt yet encountered them.. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-wont-find-selected-value-in-edit-tp4300292p4300494.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: T5: Select wont find selected value in edit?
On Wed, 13 Apr 2011 09:44:43 -0300, robnangle robnan...@gmail.com wrote: Ok and this method should be in the getKeepers()? It should be in the class of the objects used as options. What do i check if its equal to? It varies depending on the class itself, what it means and how object identity is defined for it. Apologies for what probably are stupid questions, I just hevnt yet encountered them.. This is basic Java knowledge. Check this: http://www.ibm.com/developerworks/java/library/j-jtp05273/index.html -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: @Validate on RadioGroup
Taha - You are correct, I was wrong. I patched up RadioGroup by adding: Binding defaultValidate() { return defaultProvider.defaultValidatorBinding(value, resources); } and now the @Validate annotation on my bean enum property is read in correctly. So this is the bug in RadioGroup, which is missing the above as you pointed out. Adam On Wed, Apr 13, 2011 at 7:25 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi Adam Hi Adam On Wed, Apr 13, 2011 at 5:19 PM, Adam Zimowski zimowsk...@gmail.com wrote: Hi Taha, You are still not getting the point... Why so direct, having a bad day? Please tell me how am I not getting the point when I clearly wrote that: Sorry if it appeared rude, that was certainly not my intention (In my defense, English is not my first language). I think it should have been you are missing the point :) t:radiogroup validate=required Works. The validate parameter is not null with the above, and the Radio group works as expected, as shown in RadioGroup processSubmission(): if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); I think you are missing the point. I realized that validate parameter in RadioGroup is null when @Validate on the bean is present and so validation does not get triggered. If this is a bug, which we both seem to agree, rather than stating the obvious, I would be interested (due to lack of expertise in Tapestry) where in the source does Tapestry read a @Validate annotation off a bean field, and interprets it accordingly. That I mentioned in my last mail The RadioGroup does not seem to be the problem, and the if statement it contains to test nullability of the validate parameter is not the issue, either. RadioGroup is the problem as it does not contain defaultValidate(){ return defaultProvider.defaultValidatorBinding(value, resources); } If it was there the defaultProvider(as I already mentioned in my previous mail) with indirectly take care of the case where validate @Parameter is null Regards, Adam Sorry again regards Taha On Wed, Apr 13, 2011 at 6:30 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: You are still not getting the point... 1. fieldValidationSupport,validate is the service responsible for validating a field. It requries a FieldValidator which is passed as a parameter to it. If this @Parameter validate is null, as is the case with RadioGroup, fieldValidationSupport is never called as the source shows if (validate != null) fieldValidationSupport.validate(rawValue, resources, validate); 2. In other components like Select, if @Parameter validate is not provided a default is chosen. The default is provided by ComponentDefaultProvider which in turn calls FieldValidatorDefaultProvider which uses FieldValidatorSource for creating default validators based on the field annotations and type. in case of Select we have default validate like this Binding defaultValidate() { return defaultProvider.defaultValidatorBinding(value, resources); } so if we don't provide a validate, the default is chosen Now in a RadioGroup as the code does not use a default in case @Parameter validate is not provided, the field annotations are not taken into consideration regards Taha On Wed, Apr 13, 2011 at 4:24 PM, Adam Zimowski zimowsk...@gmail.com wrote: Hi Taha - I agree with you it seems to be a bug, and I (think) I get what you are saying. However, I am having a hard time seeing why the bug would be in RadioGroup processSubmission() or anywhere in the RadioGroup class for that matter. Rather, it seems the bug (if exists) is deeper in the chain, where the @Validate annotation is read off of a bean and applied to a RadioGroup. I believe this because RadioGroup *does* behave correctly if TML defines: t:radiogroup validate=required but now when the @Validate(required) is on the bean. Adam On Wed, Apr 13, 2011 at 5:35 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: it is the @Parameter validate in RadioGroup that is required not @Validate as that is never checked in case @Parameter validate is not given in a RadioGroup ... Please read my answer again :) It seems to be bug!! regards Taha On Wed, Apr 13, 2011 at 3:40 PM, Adam Zimowski zimowsk...@gmail.com wrote: Thanks Taha, but I did supply @Validate(required) annotation and validation did not happen. Adam On Tue, Apr 12, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi I compared the code from RadioGroup with that of Select and found the following difference In Select if parameter 'validate' is not given a default is chosen and so it is never null. Validation is performed in processSubmission() method by the line fieldValidationSupport.validate(selectedValue,
Absolute Paths in Tapestry 5.2.5
Hi ! I'm using Tapestry 5.2.5 and i use Glassfish behind a apache httpd as a proxy. The httpd is doing a ProxyPass / http://localhost:8080/myApp so that i am able to call my site from the root. I'm able to see my site at http://test.local/ instead of http://test.local/myApp. That works fine except the Javascript stuff. I see in the sources of the webpage that there is a path to /myApp/0.1-SNAPSHOT/stack/core.js is inserted. But there is no path beginning with /myApp... because i changed this with the proxy to the root of the domain. Is it possible to change those relative uris to absolute uris ? Thanks a lot Jochen -- View this message in context: http://tapestry.1045711.n5.nabble.com/Absolute-Paths-in-Tapestry-5-2-5-tp4300824p4300824.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: Absolute Paths in Tapestry 5.2.5
On Wed, 13 Apr 2011 12:04:38 -0300, Jochen Heintz jochen.hei...@gameforge.com wrote: Hi ! Hi! Is it possible to change those relative uris to absolute uris ? Take a look at BaseURLSource. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Absolute Paths in Tapestry 5.2.5
Hi, i am tried this in AppModule : public static void contributeAlias(Configuration configuration) { BaseURLSource source = new BaseURLSource() { public String getBaseURL(boolean secure) { return http://;; } }; configuration.add(AliasContribution.create(BaseURLSource.class, source)); } but the method getBaseURL gets never called. Did i missed something. Thanks Jochen -- View this message in context: http://tapestry.1045711.n5.nabble.com/Absolute-Paths-in-Tapestry-5-2-5-tp4300824p4300975.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: @Broadcast annotation
I haven't played with Atmosphere specifically, but I've played a bit Jetty continuations, or Servlet 3's startAsync in Tapestry. It's not a trivial integration, but I've gotten something barely working using Jetty's Continuations. For my solution I created an @AsyncEvent which essentially hijacks the event method and wraps it in a Runnable that gets dumped into a threadpool. When the method completes it resumes the continuation. The challenge is that both the Servlet3 and Jetty Continuation (and atmosphere from the look of it) expect you to return from your event method when you suspend. This means that you go all they way back up the stack to the container where it notes that you've suspended the request and then re-issues the request when you resume. For tapestry, this means that it thinks you're done with the request and starts cleaning up all the injectable services that you probably still need to finish your suspended request. I did this all about 6 months ago and haven't had a chance to get into the tapestry source to work out a way to teach it about suspended requests. Josh On Tue, Apr 12, 2011 at 4:48 AM, tmar...@gmx.de wrote: Hello again! Is there any way to get the @Broadcast annotation from Atmosphere: http://atmosphere.java.net/nonav/apidocs/org/atmosphere/annotation/Broadcast.html working inside of a Tapestry5 page or component? Or are there any general, architectural restrictions why this can not work in Tapestry right now? If not, what changes would be necessary in order to be able to be able to use it? Thanks! Tobias - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Absolute Paths in Tapestry 5.2.5
We faced problems with the root and app contexts using HTTPD/Apache in front of a Servlet Container as well at my company. Our solution was as follows, all in HTTPD. I thought I'd post this in case you find it useful. You will probably be interested in the lines from ssl.conf (if you don't use HTTPS then put in the httpd.conf). If you run more than just the myApp on the server, you'd need a RewriteCond(s) to exempt your other apps/pages from the rewrite: httpd.conf (forces HTTPS and maps to the servlet port on requests to the app context): RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} ProxyRequests Off Proxy */myApp Order deny,allow Allow from all /Proxy ProxyPass /myApp http://localhost:8080/myApp ProxyPassReverse /myApp http://localhost:8080/myApp ssl.conf (maps requests not to the app, such as root, to the app context): RewriteEngine On RewriteRule !^/myApp https://%{HTTP_HOST}/myApp%{REQUEST_URI} On 04/13/2011 12:04 PM, Jochen Heintz wrote: Hi, i am tried this in AppModule : public static void contributeAlias(Configuration configuration) { BaseURLSource source = new BaseURLSource() { public String getBaseURL(boolean secure) { return http://;; } }; configuration.add(AliasContribution.create(BaseURLSource.class, source)); } but the method getBaseURL gets never called. Did i missed something. Thanks Jochen -- View this message in context: http://tapestry.1045711.n5.nabble.com/Absolute-Paths-in-Tapestry-5-2-5-tp4300824p4300975.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Broadcast annotation
Hi Josh Did you check the meteor module. In that case the Tapestry Filter will run inside the Atmosphere Servlet. regards Taha On Wed, Apr 13, 2011 at 10:38 PM, Josh Canfield joshcanfi...@gmail.comwrote: I haven't played with Atmosphere specifically, but I've played a bit Jetty continuations, or Servlet 3's startAsync in Tapestry. It's not a trivial integration, but I've gotten something barely working using Jetty's Continuations. For my solution I created an @AsyncEvent which essentially hijacks the event method and wraps it in a Runnable that gets dumped into a threadpool. When the method completes it resumes the continuation. The challenge is that both the Servlet3 and Jetty Continuation (and atmosphere from the look of it) expect you to return from your event method when you suspend. This means that you go all they way back up the stack to the container where it notes that you've suspended the request and then re-issues the request when you resume. For tapestry, this means that it thinks you're done with the request and starts cleaning up all the injectable services that you probably still need to finish your suspended request. I did this all about 6 months ago and haven't had a chance to get into the tapestry source to work out a way to teach it about suspended requests. Josh On Tue, Apr 12, 2011 at 4:48 AM, tmar...@gmx.de wrote: Hello again! Is there any way to get the @Broadcast annotation from Atmosphere: http://atmosphere.java.net/nonav/apidocs/org/atmosphere/annotation/Broadcast.html working inside of a Tapestry5 page or component? Or are there any general, architectural restrictions why this can not work in Tapestry right now? If not, what changes would be necessary in order to be able to be able to use it? Thanks! Tobias - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Broadcast annotation
Did you check the meteor module. In that case the Tapestry Filter will run inside the Atmosphere Servlet. I've spent too much of today reading the white paper and experimenting because I'm intrigued by anything async these days. Atmosphere can work with Tapestry, as long as you don't want to do anything Tapestry-like when you get a broadcast. I mistakenly assumed that this was a more general Continuations library (as is provided in jetty-continuations), really it appears to be more about doing more pubsub/broadcast type apps. My use case is more about freeing up server threads while I continue to process the request. When you receive a broadcast you are not in the Tapestry stack. You might think it would be cool to use your @Inject'd services when you get a broadcast, but you'll get an NPE because the thread that executes the broadcast is not a thread that has been setup by tapestry. Your page attributes are stored as thread locals and so you will have none. You can however format and write your own response. To answer the OPs question, you could write a ComponentClassTransformerWorker which checked for the @Broadcast on page/component events and trigger a broadcast. If you implement a ResultProcessor for some object that doesn't write to the response and turn off GZIP compression (always seams to want to write something). If you use the MeteorServlet then you also need to rename your AppModule to TapestryFilterModule because of how MeteorServlet names your filter. Josh On Wed, Apr 13, 2011 at 10:26 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi Josh Did you check the meteor module. In that case the Tapestry Filter will run inside the Atmosphere Servlet. regards Taha On Wed, Apr 13, 2011 at 10:38 PM, Josh Canfield joshcanfi...@gmail.comwrote: I haven't played with Atmosphere specifically, but I've played a bit Jetty continuations, or Servlet 3's startAsync in Tapestry. It's not a trivial integration, but I've gotten something barely working using Jetty's Continuations. For my solution I created an @AsyncEvent which essentially hijacks the event method and wraps it in a Runnable that gets dumped into a threadpool. When the method completes it resumes the continuation. The challenge is that both the Servlet3 and Jetty Continuation (and atmosphere from the look of it) expect you to return from your event method when you suspend. This means that you go all they way back up the stack to the container where it notes that you've suspended the request and then re-issues the request when you resume. For tapestry, this means that it thinks you're done with the request and starts cleaning up all the injectable services that you probably still need to finish your suspended request. I did this all about 6 months ago and haven't had a chance to get into the tapestry source to work out a way to teach it about suspended requests. Josh On Tue, Apr 12, 2011 at 4:48 AM, tmar...@gmx.de wrote: Hello again! Is there any way to get the @Broadcast annotation from Atmosphere: http://atmosphere.java.net/nonav/apidocs/org/atmosphere/annotation/Broadcast.html working inside of a Tapestry5 page or component? Or are there any general, architectural restrictions why this can not work in Tapestry right now? If not, what changes would be necessary in order to be able to be able to use it? Thanks! Tobias - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Absolute Paths in Tapestry 5.2.5
Are you deploying multiple apps to glassfish? If not have you considered deploying your app to the root context? On Wed, Apr 13, 2011 at 8:04 AM, Jochen Heintz jochen.hei...@gameforge.com wrote: Hi ! I'm using Tapestry 5.2.5 and i use Glassfish behind a apache httpd as a proxy. The httpd is doing a ProxyPass / http://localhost:8080/myApp so that i am able to call my site from the root. I'm able to see my site at http://test.local/ instead of http://test.local/myApp. That works fine except the Javascript stuff. I see in the sources of the webpage that there is a path to /myApp/0.1-SNAPSHOT/stack/core.js is inserted. But there is no path beginning with /myApp... because i changed this with the proxy to the root of the domain. Is it possible to change those relative uris to absolute uris ? Thanks a lot Jochen -- View this message in context: http://tapestry.1045711.n5.nabble.com/Absolute-Paths-in-Tapestry-5-2-5-tp4300824p4300824.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Broadcast annotation
That is exactly what i had concluded except for the injection part of it. Thanks for your insight regards Taha On Thu, Apr 14, 2011 at 3:57 AM, Josh Canfield joshcanfi...@gmail.comwrote: Did you check the meteor module. In that case the Tapestry Filter will run inside the Atmosphere Servlet. I've spent too much of today reading the white paper and experimenting because I'm intrigued by anything async these days. Atmosphere can work with Tapestry, as long as you don't want to do anything Tapestry-like when you get a broadcast. I mistakenly assumed that this was a more general Continuations library (as is provided in jetty-continuations), really it appears to be more about doing more pubsub/broadcast type apps. My use case is more about freeing up server threads while I continue to process the request. When you receive a broadcast you are not in the Tapestry stack. You might think it would be cool to use your @Inject'd services when you get a broadcast, but you'll get an NPE because the thread that executes the broadcast is not a thread that has been setup by tapestry. Your page attributes are stored as thread locals and so you will have none. You can however format and write your own response. To answer the OPs question, you could write a ComponentClassTransformerWorker which checked for the @Broadcast on page/component events and trigger a broadcast. If you implement a ResultProcessor for some object that doesn't write to the response and turn off GZIP compression (always seams to want to write something). If you use the MeteorServlet then you also need to rename your AppModule to TapestryFilterModule because of how MeteorServlet names your filter. Josh On Wed, Apr 13, 2011 at 10:26 AM, Taha Hafeez tawus.tapes...@gmail.com wrote: Hi Josh Did you check the meteor module. In that case the Tapestry Filter will run inside the Atmosphere Servlet. regards Taha On Wed, Apr 13, 2011 at 10:38 PM, Josh Canfield joshcanfi...@gmail.com wrote: I haven't played with Atmosphere specifically, but I've played a bit Jetty continuations, or Servlet 3's startAsync in Tapestry. It's not a trivial integration, but I've gotten something barely working using Jetty's Continuations. For my solution I created an @AsyncEvent which essentially hijacks the event method and wraps it in a Runnable that gets dumped into a threadpool. When the method completes it resumes the continuation. The challenge is that both the Servlet3 and Jetty Continuation (and atmosphere from the look of it) expect you to return from your event method when you suspend. This means that you go all they way back up the stack to the container where it notes that you've suspended the request and then re-issues the request when you resume. For tapestry, this means that it thinks you're done with the request and starts cleaning up all the injectable services that you probably still need to finish your suspended request. I did this all about 6 months ago and haven't had a chance to get into the tapestry source to work out a way to teach it about suspended requests. Josh On Tue, Apr 12, 2011 at 4:48 AM, tmar...@gmx.de wrote: Hello again! Is there any way to get the @Broadcast annotation from Atmosphere: http://atmosphere.java.net/nonav/apidocs/org/atmosphere/annotation/Broadcast.html working inside of a Tapestry5 page or component? Or are there any general, architectural restrictions why this can not work in Tapestry right now? If not, what changes would be necessary in order to be able to be able to use it? Thanks! Tobias - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Broadcast annotation
On Wed, 13 Apr 2011 19:27:06 -0300, Josh Canfield joshcanfi...@gmail.com wrote: When you receive a broadcast you are not in the Tapestry stack. You might think it would be cool to use your @Inject'd services when you get a broadcast, but you'll get an NPE because the thread that executes the broadcast is not a thread that has been setup by tapestry. I don't think this is correct with regard to services that don't use HttpServletRequest or HttpServletResponse directly or indirectly. If I'm right, you can use most of your Tapestry services on them, speciallyl the singleton ones. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Broadcast annotation
I don't think this is correct with regard to services that don't use HttpServletRequest or HttpServletResponse directly or indirectly. If I'm right, you can use most of your Tapestry services on them, speciallyl the singleton ones. Ah yes, of course you are right. The proxy will get/create the service for the thread if it doesn't exist. I should have just done the test... The funny thing is, I was using an @Inject'd logger so clearly everything isn't null... Josh On Wed, Apr 13, 2011 at 5:31 PM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: On Wed, 13 Apr 2011 19:27:06 -0300, Josh Canfield joshcanfi...@gmail.com wrote: When you receive a broadcast you are not in the Tapestry stack. You might think it would be cool to use your @Inject'd services when you get a broadcast, but you'll get an NPE because the thread that executes the broadcast is not a thread that has been setup by tapestry. I don't think this is correct with regard to services that don't use HttpServletRequest or HttpServletResponse directly or indirectly. If I'm right, you can use most of your Tapestry services on them, speciallyl the singleton ones. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Help required in using AJAX Functionality in Tapestry 4.1
Hi, I am new to tapestry and have a requirement to implement AJAX Functionality in Tapestry 4.0. I am writing a simple program wherein i enter a value in a textfield and click on the submit button and that value has to be displayed in the same page without the page being refreshed.Currently I am following Kent Tong's Enjoying Web Framework with Tapestry 3rd Edition wherein a huge example program on AJAX is given which i am finding hard to follow and implement. Here is the Home.page,Home.html and java file for my program Please guide me whether i have written the right code for meeting the above functionality Home.html - Home.page - ?xml version=1.0 ? lt;!DOCTYPE page-specification PUBLIC quot;-//Apache Software Foundation//Tapestry Specification 4.0//ENquot; quot;http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtdquot;gt; Home.java - package com.tapestry; import org.apache.hivemind.util.PropertyUtils; import org.apache.tapestry.html.BasePage; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.IPage; import org.apache.tapestry.annotations.*; public abstract class HelloWorld extends BasePage { public IRequestCycle cycle; @InjectPage(Home) public abstract IPage getResultPage(); public abstract String getUserName(); public abstract String getUserName1(); public abstract void setUserName1(String userName1); public IPage onFormSubmit(IRequestCycle cycle){ setUserName1(getUserName()); IPage resultPage = getResultPage(); String temp = test :; PropertyUtils.write(getResultPage(),userName1,temp + new String(getUserName1())); return resultPage; } } P.S - I being a novice to both AJAX and Tapestry do not know much in details .Please provide brief about any corrections to be done to this code. Regards Nazar -- View this message in context: http://tapestry-users.832.n2.nabble.com/Help-required-in-using-AJAX-Functionality-in-Tapestry-4-1-tp6271536p6271536.html Sent from the Tapestry Users 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