سؤال

Ajax applications, and GWT in particular, use the URL fragment (e.g. http://example.com/myapp#fragment) to maintain application state on the client without reloading the page.

Is there a GWT library that facilitates the encoding and decoding of arbitrary parameters into the URL fragment? I'm looking for something analogous to the Servlet API's getParameter() method, but for client-side URL parameters.

هل كانت مفيدة؟

المحلول

You may want to investigate gwt-platform, it includes features for reading/modifying parameters in the fragment, as well as a ton of other great MVP features, like EventBus, Presenters, even easier async loading of JS, etc. It looks pretty awesome.

Specifically, check out the "Using URL parameters" section of this guide.

نصائح أخرى

If we talk about gwt-platform there is another very good framework called mvp4g. The goal of the Mvp4g framework is to help you build GWT applications easily, following best practices shown by Ray Ryan at the Google I/O:

Event Bus Dependency Injection Model View Presenter Place Service

It also includes HistoryConverter that makes url parameters easy to use.

GWT has a built-in framework called "Activities and Places" that employs these url fragments. It makes bookmarking and history managment possible.

https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces

Also, watch this I/O video (starts at 18:15) to see how this works.

http://www.youtube.com/watch?feature=player_detailpage&v=0F5zc1UAt2Y#t=1094s

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top