Question

I asked a related question here

How do I programatically write parameters into the URL using GWT? I've learned from my previous question that parameters need to go before the anchor, but how do I do that from GWT?

Here's the code that doesn't work:

Hyperlink pg1 = new Hyperlink("Test", "?testing=abc#pg1");

It results in the following url:

http://localhost:8080/Athena.html#?testing=abc%23pg1

I was thinking about using Window.Location.assign(), but the javadoc says that will loose the state of my application.

Was it helpful?

Solution

The object HyperLink seems to be for linking to internal states, and probably was written so that changing its href is difficult?

I suggest you use this class http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/InlineHTML.html instead - obviously you are generating the href programatically, so it should be easy to generate the element to supply to the InlineHTML object.

OTHER TIPS

You are using this constructor which receives a history token as the second constructor argument, hence you are getting said result.

Use the setHTML() method to set the correct value on the link.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top