You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Todd Nine <to...@spidertracks.co.nz> on 2010/09/27 07:29:51 UTC

RESTful URLS with AJAX tabbed panel

Hi all,
  We've built several tabbed panels, and we're in the process of converting
them over the AjaxTabbedPanel subclasses.  We really want RESTful URLS in
our system, we're accomplishing this with mountpath on different pages as
different tabs are selected.  Is it possible to configure the
AJAXTabbedPanel subclasses to update the browser URL to have the format

/<page name#tabName.

This way the client browser won't refresh during the ajax call, and it can
be rewritten via anchor tag syntax.  However, when a user copy/pastes this
URL to another user, I want the same tab to load.  Can someone give me an
example of how to go about this?

Thanks,
Todd

Re: RESTful URLS with AJAX tabbed panel

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Mon, Sep 27, 2010 at 12:29 AM, Todd Nine <to...@spidertracks.co.nz> wrote:

> Hi all,
>  We've built several tabbed panels, and we're in the process of converting
> them over the AjaxTabbedPanel subclasses.  We really want RESTful URLS in
> our system, we're accomplishing this with mountpath on different pages as
> different tabs are selected.  Is it possible to configure the
> AJAXTabbedPanel subclasses to update the browser URL to have the format
>
> /<page name#tabName.
>

Do this with JS and one of the many JS frameworks out there (i.e. YUI
history manager).  In your AJAX link that changes tabs, you'll
appendJavascript("...code...") that adds the hash tag.


> This way the client browser won't refresh during the ajax call, and it can
> be rewritten via anchor tag syntax.  However, when a user copy/pastes this
> URL to another user, I want the same tab to load.  Can someone give me an
> example of how to go about this?
>

This will be the more difficult part, because the hash tag is not sent to
the server.  So, you'll have to initially load the default tab.  Then, use
the same JS framework to get that the hash tag is there and call back to the
server to load the correct tab.  You can add a custom Behavior that
integrates a wicket callback with your custom JS for this.

Best regards,

-- 
Jeremy Thomerson
http://www.wickettraining.com