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 <[email protected]>

>
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to