java GWT 网址参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1128575/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GWT URL Parameters
提问by KevMo
What is the proper way to use URL parameters?
使用 URL 参数的正确方法是什么?
My URL is this: http://localhost:8080/#pg5?testing=abc
我的网址是这样的: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:
我想也许它没有得到正确的 URL,但这段代码返回了正确的 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.
我知道我可以解析 url 来获取我的参数,但我认为这就是 getParamerter() 的用途。

