在GWT中使用查询字符串 [英] working with Query String in GWT

查看:171
本文介绍了在GWT中使用查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须创建一个包含用户标识和电子邮件参数的动态URL,它将直接在我的GWT应用程序中注册表单。我想设置并获取查询字符串中的参数。我已经提到了tp http://code.google.com/p/gwt-examples/source/browse/trunk/System/src/com/gawkat/gwt/system/client/global/QueryString .java?r = 1241 ,但这里的QueryStringData对我的项目是无法访问的。请告诉我我该怎么做?任何替代方案也可以帮助我。

I have to created a dynamic URLcontaining the user id and email parameters, which will direct to sign up form in my GWT application. I want to set and get the parameters in the query string. I have referred tp http://code.google.com/p/gwt-examples/source/browse/trunk/System/src/com/gawkat/gwt/system/client/global/QueryString.java?r=1241 but here QueryStringData is inaccessible to my project.Please tell me how I can do it? Any alternative could also help me.

推荐答案

不要认为GWT中有一个简单的标记化查询字符串解析器。但是,您可以通过以下方式获取原始查询字符串:

Don't think there's a simple tokenized query string parser in GWT. But you can get the raw query string by using:

String queryString = Window.Location.getQueryString();

以任何你喜欢的方式解析它。我使用它来设置调试标志等:

Parse it any way you like. I use it like this to set debug flags etc.:

boolean debugMode = Window.Location.getQueryString().indexOf("debug=true") >= 0;

请注意,更改url的查询部分的值()将重新加载页面。在更改url的哈希部分(在之后的任何内容)时,不会重新加载页面。这就是com.google.gwt.user.client.History使用散列部分的原因。

Note that changing values in the query part of the url (between the ? and the #) will reload the page. While changing the "hash part" of the url (anything after the #) will not reload the page. Which is why the com.google.gwt.user.client.History uses the hash part.

这篇关于在GWT中使用查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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