GWT 网址参数 [英] GWT URL Parameters
问题描述
URL 参数的正确使用方法是什么?
What is the proper way to use URL parameters?
我的网址是这样的: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".
我想也许它没有得到正确的 URL 但这段代码返回了正确的 URL:
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();
我知道我可以解析 url 来获取我的参数,但我认为这就是 getParamerter() 的用途.
I know I can parse the url to get my parameters, but I thought that's what getParamerter() was for.
推荐答案
url 应该是 http://localhost:8080/?testing=abc#pg5 而不是 http://localhost:8080/#pg5?testing=abc
url should be http://localhost:8080/?testing=abc#pg5 instead of http://localhost:8080/#pg5?testing=abc
这篇关于GWT 网址参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!