Reputation: 1294
I have a Java/GWT application. In that there is a list of items. If I click on any item title then that item is opened with full description.
I am using Anchor for the item title, so what I want is when user clicks on item title then in the URL the id of that item is appended to the current URL.
For example, this is my URL:
"http://127.0.0.1:8888/MyApp.html?gwt.codesvr=127.0.0.1:9997#listItem?list"
and I have to append id to the end of the URL like:
"http://127.0.0.1:8888/MyApp.html?gwt.codesvr=127.0.0.1:9997#listItem?list&itemId=55"
Upvotes: 3
Views: 7056
Reputation: 17
URIBuilder of Apache HttpComponents offers a convenient method to add parameters and will deal with existing query parameters and anchors.
Upvotes: -2
Reputation: 1876
Using Window.Location should do your trick : see the doc here
Something like this :
String url = Window.Location.getHref();
url = url + "&itemId=" + itemId;
Window.Location.replace(url);
Although of course, as Crollster pointed out, you should insert your url parameter before the # sign. Give more details on what you're looking for exactly (why do you have to add the parameter manually, does the page have to reload ...)
Upvotes: 2
Reputation: 2771
You see that #
in the URL? Thats an anchor - you will need your parameter to be added before that, so it looks like this:
http://127.0.0.1:8888/MyApp.html?gwt.codesvr=127.0.0.1:9997&itemId=55#listItem?list
HTH
Upvotes: 0
Reputation: 9914
You can try with javascript
coding.When the user clicks on link, get this URL
and appends your id to it and reconstruct the URL
.
Upvotes: 0
Reputation: 5219
you can use redirect command in order to add this parameter
response.sendRedirect(your url + itemId=55);
Then you can extract this variable.
I hope this will help.
Upvotes: 1