Java – pass parameters using GWT history?

I have a page called orders and a page called orderdetails As described in the excellent MVP tutorial, I am using history (with a central value change listener) and an "event bus" handler manager

I have a registration procedure event where someone clicks on an order, which basically creates OrderDetailPresenter, passing in the order ID (contained in ShowOrderDetailEvent), and then calling History.. newItem(“orderDetails”).

This has several main disadvantages: the newly created history step does not know which order ID is passed. For example, if someone sends the order details page (or returns it in the browser and then forwards it), they will get an empty page without orders

So my question is: should it be like history Newitem ("orderdetails? Id =" Id ") does this, and then parses my value to change the history in the listener? If so, is it best to use an API or library to parse and format parameters into a string in this way?

Solution

Yes, that's what you should do. As far as I know, no library makes it easier

A little advice, though, if possible, you should avoid using a scheme that requires you to use percentage escape in the history item string The reason is that when location Href at the end, what location Hash returns that #< @@ varies with the browser For example, chrome returns #< @@; Firefox returns # < @ @ Set location Hashes can have similar browser - specific effects GWT's historical token mechanism depends on location Hash, and will not normalize this difference in browser behavior The end result is that if you use something that requires percentage escape, you will get a web address that cannot be shared through the browser - this problem will occur if you want to generate a link to a specific location in GWT on other pages, or you want users to share a URL linked to your GWT application (or when your users install chrome, they import their bookmarks from Firefox and point to a specific location in your webapp. Suddenly, the bookmarks don't work.) for paranoia, I will avoid putting any?, #, &%< Or > characters in your history string However, strings like orderdetails / oid = 12313378 should be good and cross - browser

(edit to clarify what I'm talking about is dealing with using the same URL in multiple different browsers instead of using the history method in various browsers)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>