简体   繁体   English

GWT:刷新页面会使整个Web应用程序重新启动。 我应该在哪里保存州?

[英]GWT: Refresh page causes whole web app to restart. Where shall I save states?

I am quite new to GWT. 我对GWT非常陌生。 One question I have got recently is about reloading a webpage. 我最近遇到的一个问题是关于重新加载网页。

Say my web app have two pages A and B. Page A is a login page. 假设我的Web应用程序有两个页面A和B。页面A是登录页面。 After login, the user will be taken to page B. If the user pressed reload button on page B, the whole web app is restarted (onModuleLoad of the EntryPoint will be called again). 登录后,用户将转到页面B。如果用户按下页面B上的重新加载按钮,则整个Web应用程序将重新启动(EntryPoint的onModuleLoad将再次被调用)。 Although I use History to keep the browser on page B, all the objects that hold states are re-created hence page B will fail load (eg user login information etc). 尽管我使用“历史记录”将浏览器保留在页面B上,但所有具有状态的对象都被重新创建,因此页面B将无法加载(例如,用户登录信息等)。

I am sure this is a very common problem for GWT developers. 我确信这对于GWT开发人员来说是一个非常普遍的问题。 Can someone let me know: 有人可以让我知道:

1. How to keep some of the objects in GWT while reloading page? 
2. Is there anyway to just reload a page rather than the whole web app?

Many thanks 非常感谢

Try https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces . 尝试https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces In case you really need to store something you might use Cookies, HTML5 storage, or use some server-side storage which you access via RPC. 如果您确实需要存储某些内容,则可以使用Cookies,HTML5存储或使用通过RPC访问的某些服务器端存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM