Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT URL Parameters

Tags:

java

url

gwt

What is the proper way to use URL parameters?

My URL is this: http://localhost:8080/#pg5?testing=abc

In my code I try to get the value of testing using this line of code:

String value = com.google.gwt.user.client.Window.Location.getParameter("testing");

Unfortunately all this does is set my string to "undefined".

I thought perhaps it wasn't getting the correct URL but this code returns the proper URL:

String value = com.google.gwt.user.client.Window.Location.getHref();

I know I can parse the url to get my parameters, but I thought that's what getParamerter() was for.

like image 878
KevMo Avatar asked Jul 14 '09 23:07

KevMo


People also ask

Can I pass URL as query parameter?

Yes, that's what you should be doing. encodeURIComponent is the correct way to encode a text value for putting in part of a query string. but when it is decoded at the server, the parameters of url are interpreted as seperate parameters and not as part of the single url parameter.

What is get parameter in URL?

GET parameters (also called URL parameters or query strings) are used when a client, such as a browser, requests a particular resource from a web server using the HTTP protocol. These parameters are usually name-value pairs, separated by an equals sign = .


1 Answers

url should be http://localhost:8080/?testing=abc#pg5 instead of http://localhost:8080/#pg5?testing=abc

like image 161
Maksim Avatar answered Sep 29 '22 12:09

Maksim