public class LogOutPage extends WebPage
{
           public LogOutPage ()
           {
                    AjaxLogOut ajaxLogOut = new AjaxLogOut(this);
                    add(ajaxLogOut);
           }
}

public class AjaxLogOut extends AbstractAjaxTimerBehavior
{
           WebPage page;
           private static Logger log =
Logger.getLogger(AjaxLogOut.class.getName());

           public AjaxLogOut(WebPage page)
           {
                super(Duration.seconds(20));
                this.page = page;
           }

           protected void onTimer(AjaxRequestTarget target)
           {
                log.info("timer called");
                page.setResponsePage(new LogOutConfirmation());
           }
}


This didn't work since the onTimer method was not called after 20 seconds.
Any help here is greatly appreciated.

Thanks




igor.vaynberg wrote:
> 
> On 1/26/07, tbt <[EMAIL PROTECTED]> wrote:
>>
>>
>> I coded a class that extends  AbstractAjaxTimerBehavior and implemented
>> the
>> protected void onTimer(AjaxRequestTarget target) method. Is this method
>> supposed to be called after the given time duration?
> 
> 
> read the javadoc
> /**
>      * Listener method for the AJAX timer event.
>      *
>      * @param target
>      *            The request target
>      */
>     protected abstract void onTimer(final AjaxRequestTarget target);
> 
> And how should I redirect the page inside this method. Can someone provide
>> me with a sample example.
> 
> 
> just like anywhere else, setResponsePage()
> 
> -igor
> 
> 
> Thanks
>>
>>
>> Matej Knopp wrote:
>> >
>> > This won't work. Because you can call setResponsePage only during
>> > processing a request. When your code calls setResponsePage() there is
>> no
>> > request, so it doesn't make sense to set response page.
>> >
>> > I think what you want is AbstractAjaxTimerBehavior.
>> >
>> > -Matej
>> >
>> > tbt wrote:
>> >> Hi!
>> >>
>> >> I'd like to know how to redirect a page automatically using wicket
>> after
>> >> a
>> >> given time interval. Currently i'm using the following java class to
>> do
>> >> this
>> >>
>> >> Timer timer = new Timer();
>> >>              timer.schedule(new TimerTask()
>> >>              {
>> >>                      public void run()
>> >>                      {
>> >>                               setResponsePage(new
>> LogOutConfirmationPage());
>> >>                      }
>> >>              }
>> >>              , 1 * 60 * 1000);
>> >>
>> >> This is supposed to redirect the page after 1 minute but Wicket is
>> >> throwing
>> >> the following runtime exception "There is no application attatched to
>> the
>> >> current thread"
>> >>
>> >>
>> >> Is there any way to do this using the wicket framework?
>> >>
>> >>
>> >
>> >
>> >
>> -------------------------------------------------------------------------
>> > Take Surveys. Earn Cash. Influence the Future of IT
>> > Join SourceForge.net's Techsay panel and you'll get the chance to share
>> > your
>> > opinions on IT & business topics through brief surveys - and earn cash
>> >
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Redirecting-a-page-after-a-given-time-interval-tf3097478.html#a8647823
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Redirecting-a-page-after-a-given-time-interval-tf3097478.html#a8704328
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to