GWT URL参数 [英] GWT URL Parameters

查看:85
本文介绍了GWT URL参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用URL参数的正确方法是什么?

What is the proper way to use URL parameters?

我的URL是这样的: http:// localhost:8080 /#pg5?testing = abc

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");

不幸的是,所有这些都会将我的字符串设置为undefined。

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 URL参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆