Re: Reusable login component
Hi, Katia! On Thu, 25 Nov 2010 06:13:48 -0200, Katia Aresti katiaare...@gmail.com wrote: There are always several ways to do the same thing. @Thiago Doing with events like this, does not come up to the same to same thing ? In the end I have to catch the event on my page to decide where to go. So, why not telling the component from the beginning where to go ? I mean, why complicating life defining new events handling, triggering and catching for this use case ? Isn't it simpler and more readable to tell the login form where to go from the beginning ? I guess you're right. :) When I read your message, I've read parameter as query parameter, not as component parameter. (facepalm) -- 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: Reusable login component
How to tell the component from the beginning where to go? Because it depends on the parent page where the login component is included AND on a authentication fonction success? Here is my Login component : public class Login { @Inject private IAuthenticationService authenticationService; @Property private String login; @Property private String password; public Object onSuccess () { if (authenticationService.login (login, password) != null) { return (Main.class); } return (Index.class); } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reusable-login-component-tp3279297p3280031.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: Reusable login component
Hi ! Use events and callbacks, see ComponentResources.triggerEvent 2010/11/25 Tibo23 thibault.malbra...@gmail.com How to tell the component from the beginning where to go? Because it depends on the parent page where the login component is included AND on a authentication fonction success? Here is my Login component : public class Login { @Inject private IAuthenticationService authenticationService; @Property private String login; @Property private String password; public Object onSuccess () { if (authenticationService.login (login, password) != null) { return (Main.class); } return (Index.class); } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reusable-login-component-tp3279297p3280031.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 -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Reusable login component
Without doing it with callbacks and events, more simple for your use case : you can define 2 input parameters like this in you component : @Parameter(defaultPrefix = BindingConstants.LITERAL) private String successPage; @Parameter(defaultPrefix = BindingConstants.LITERAL) private String errorPage; you change like this : public Object onSuccess () { if (authenticationService.login (login, password) != null) { return successPage; } return errorPage; } And finally when you use you component, you can pass the values as parameters on the same way as you do it with other components. Katia 2010/11/25 Tibo23 thibault.malbra...@gmail.com How to tell the component from the beginning where to go? Because it depends on the parent page where the login component is included AND on a authentication fonction success? Here is my Login component : public class Login { @Inject private IAuthenticationService authenticationService; @Property private String login; @Property private String password; public Object onSuccess () { if (authenticationService.login (login, password) != null) { return (Main.class); } return (Index.class); } } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reusable-login-component-tp3279297p3280031.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