Link to tab in page directly

2 views
Skip to first unread message

fragtallica

unread,
Mar 17, 2008, 1:55:05 PM3/17/08
to Google Web Toolkit
I have a site based on tabs, but how can I link to a certain tab.
Now I'm working with history support, so every time I click a tab the
url changes (Index.html#text), but when I go directly to
Index.html#text I just go to the default tab. How can I make my
application go to the specified tab?

Also, the tomcat is hosted on port 9080, so my website url is
http://ceuleers.eu:9080/wceuleers/Index.html and I have ceuleers.eu
redirecting to it. Is it also possible to redirect ceuleers.eu/text to
http://ceuleers.eu:9080/wceuleers/Index.html#text?
And is it possible to not show ...9080/index... in the url box, but
something like http://www.ceuleers.eu/text?

Ian Petersen

unread,
Mar 17, 2008, 2:04:46 PM3/17/08
to Google-We...@googlegroups.com
On Mon, Mar 17, 2008 at 1:55 PM, fragtallica <theg...@gmail.com> wrote:
> How can I make my
> application go to the specified tab?

I don't know how to do that since I haven't played with the History
support myself, but my understanding is that that's the whole purpose
of History support, so I'd expect there to be something in the
documentation about that. Have you had a look there?

> Also, the tomcat is hosted on port 9080, so my website url is
> http://ceuleers.eu:9080/wceuleers/Index.html and I have ceuleers.eu
> redirecting to it. Is it also possible to redirect ceuleers.eu/text to
> http://ceuleers.eu:9080/wceuleers/Index.html#text?

Yes, but to do so requires configuring your web server as opposed to
anything GWT-specific. There might be someone here to help you, but a
more targeted forum might be more useful to you.

> And is it possible to not show ...9080/index... in the url box, but
> something like http://www.ceuleers.eu/text?

I think so, but I'd bet it would break your application. If your
browser is viewing URL#fragmentA and you click a link that takes you
to URL#fragmentB, the browser shouldn't re-request or reload the
document because you've only changed the focus of the view pane from
fragmentA to fragmentB. (When I say focus I mean it in the
pre-computer sense of focus of attention--I don't mean anything to do
with focus rectangles or keyboard input targets.) On the other hand,
if you are at URL_A and you click on a link that takes you to URL_B,
the browser has no idea what's behind URL_B, so it has to send a
request to the server and render the result, which means re-loading
the page if URL_B happens to be the same object as URL_A. All this is
to say that if you rigged your app to change the URL
http://www.ceulers.eu/ to http://www.ceulers.eu/text when the user
clicks on a tab, the web browser would clear the pane, and re-execute
the bootstrap script to start the application stored at
http://www.ceulers.eu/text. If, instead, clicking on a tab at
http://www.ceulers.eu/ changed the URL to http://www.ceulers.eu/#text,
the browser would just update the URL bar and probably create a new
history record for the transition.

Ian

--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com

fragtallica

unread,
Mar 17, 2008, 3:31:44 PM3/17/08
to Google Web Toolkit
I solved the redirect from Index.html#text to the correct tab. I
forgot to check if there was already a parameter at the first load of
the module, so I added something like this:
String token = History.getToken();
if (token.length() != 0) {
onHistoryChanged(token);
}
and now it works fine.

But I still did not found a work around for the long url.

Is there a way to send multiple parameters int the URI? A site like
http://examples.roughian.com/#Tutorials~History_Support uses two
parameters, but I did not found any info about that (yet).

Gersom

Greg Hellings

unread,
Mar 17, 2008, 4:13:52 PM3/17/08
to Google-We...@googlegroups.com
Gersom,

On Mon, Mar 17, 2008 at 2:31 PM, fragtallica <theg...@gmail.com> wrote:
>
> I solved the redirect from Index.html#text to the correct tab. I
> forgot to check if there was already a parameter at the first load of
> the module, so I added something like this:
> String token = History.getToken();
> if (token.length() != 0) {
> onHistoryChanged(token);
> }
> and now it works fine.
>
> But I still did not found a work around for the long url.

This requires you to configure Tomcat to be run through your web
server (probably Apache or the like). The configuration for that is
not hard and is well documented elsewhere.

>
> Is there a way to send multiple parameters int the URI? A site like
> http://examples.roughian.com/#Tutorials~History_Support uses two
> parameters, but I did not found any info about that (yet).

I would imagine that you can tokenize the string on your separating
character (~ in the above example) and manipulate your UI
appropriately. That handling would probably be somewhere in
onHistoryChange() or somewhere appropriate like that.

--Greg

>
> Gersom
>
>
> >
>

Ian Bambury

unread,
Mar 17, 2008, 8:39:11 PM3/17/08
to Google-We...@googlegroups.com
Hi,
 
You can download the code for the demo site (or just the jar for the framework) from here http://examples.roughian.com/RXFramework/#Download
 
The different parameters are split up on the '~' character since it is not often used in text and doesn't end up mangled into a %B7 or similar, making the URI more or less readable.
 
The code isn't as simple as just splitting it up, though, as you can nest menus to any depth simply by adding menuB to menuA, menuC to menuB and so on and all the history stuff just works. The menu structure is processed recursively rather than by hard-coding (although the menu structure is hard-coded) so at each menu level, the menu class will split out the bit it needs and go to the right page (or to a default if it can't find it). example.com#menuA~menuB~menuC~menuD will successively strip off the leftmost token and pass the rest on to the next level. At the same time, it rebuilds the token string depending on your navigation around the site, so you can bookmark it and return.
 
If you need more info, let me know
 
Ian
 

fragtallica

unread,
Mar 20, 2008, 12:38:33 PM3/20/08
to Google Web Toolkit
The problem is I rent webhosting somewhere with Tomcat hosting (I took
me a while before I found a payable tomcat webserver), so I can't
change the config.

Is it correct that when you typ a specific url, with a token (for
example http://ceuleers.eu:9080/wceuleers/Index.html#CV) the URL never
changes anymore? When I go to another tab, the url stays the same but
the back and forward button stil works.

Ian Bambury

unread,
Mar 20, 2008, 1:11:57 PM3/20/08
to Google-We...@googlegroups.com
Hi,
 
The Tomcat thing is not an issue, it doesn't affect this.
 
A simple GWT app is a single page and using the back button will take you out of your GWT app and back to whever you were before. Clicking tabs won't affect this, you'll still leave your GWT app, you won't go back to the previous tab.
 
However, if you write in history support, you can make tha back and forward buttons work inside your GWT app. You do this by working with the bit of the URL after the '#', so you will see the URL change from (on my site) http://examples.roughian.com/#Home to http://examples.roughian.com/#Panels~Summary if you start on the home page and click the 'Panels' button.
 
A lot of this you have to code in yourself, but the actual setting and getting to the bit after the '#' is done by GWT
 
Ian
 

fragtallica

unread,
Mar 20, 2008, 3:46:32 PM3/20/08
to Google Web Toolkit
Hi,

I think I didn't explain it well, the problem I meant is as follow:

I go to my site; I type http://www.ceuleers.eu in the address bar
I click on some tabs, and the history in gwt adds the correct tokens
to the url
I click back, the sites goes back to the previous page, and the url in
the address bar changes
I now edit the token myself en hit the enter button; the site changes
pages correctly
But when I now go the another page (in the GWT app), the url in the
address bar doesn't change anymore (but the History still works)
So after clicking a while, the address bar still is the same as the
one I typed in earlier.

Is this problem caused by fault coding? Because with other sites (like
examples.roughian.com) I expierence the same problem.

On 20 mrt, 18:11, "Ian Bambury" <ianbamb...@gmail.com> wrote:
> Hi,
>
> The Tomcat thing is not an issue, it doesn't affect this.
>
> A simple GWT app is a single page and using the back button will take you
> out of your GWT app and back to whever you were before. Clicking tabs won't
> affect this, you'll still leave your GWT app, you won't go back to the
> previous tab.
>
> However, if you write in history support, you can make tha back and forward
> buttons work inside your GWT app. You do this by working with the bit of the
> URL after the '#', so you will see the URL change from (on my site)http://examples.roughian.com/#Hometohttp://examples.roughian.com/#Panels~Summaryif you start on the home page
> and click the 'Panels' button.
>
> A lot of this you have to code in yourself, but the actual setting and
> getting to the bit after the '#' is done by GWT
>
> Ian
>
> On 20/03/2008, fragtallica <theger...@gmail.com> wrote:
>
>
>
> > The problem is I rent webhosting somewhere with Tomcat hosting (I took
> > me a while before I found a payable tomcat webserver), so I can't
> > change the config.
>
> > Is it correct that when you typ a specific url, with a token (for
> > examplehttp://ceuleers.eu:9080/wceuleers/Index.html#CV) the URL never
Reply all
Reply to author
Forward
0 new messages