开发者

GWT and MVC type calls

I have a GWT app that when launched it takes you to a page with just a menu. So as a shortcut type thing I would like the us开发者_StackOverflow社区ers to be able to go straight to the page they want. So if the default start page is x, the should be able to say x/add and it will take them to the add page. How would I get that in gwt? Do I need a bunch of different entry points?


To accomplish this, you should use the URL's "fragment", which is the part after the #. For example, if your app is at /x, you could have a different UI displayed when someone navigates to /x#add

If you don't want to write this logic yourself, you should look into the gwt-presenter project, which was written to make MVP apps easier, but also includes an EventBus (to publish events to all corners of your app), and a PlaceManager to facilitate events being fired when the fragment changes (and to change the fragment at will).


Seems like a discussion we already had so I'll just link to the related question. Please see the answers and comments there. Basically, it might be advantageous to just interact with the History class directly, instead of introducing MVP to your project, but YMMV (I'm a huge fan of MVP myself, but it's not for everyone. Besides, I like to know the stuff "under the hood" ;))

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜