如何从客户端重定向GWT应用程序? [英] How to redirect a GWT app from the client side?

查看:104
本文介绍了如何从客户端重定向GWT应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你所知道的,servlet端的res.sendRedirect(url)不起作用,因为GWT客户端不处理它。



有谁知道如何这样做吗?



谢谢。
Daniel

解决方案

Window.Location.assign(newUrl)



但是一般情况下,您想避免这样做,因为您会失去所有客户端状态。您最好通过代码更改视图,然后更新历史记录(更新碎片网址 - #之后网址的一部分)。


As you may know, res.sendRedirect(url) on the servlet side does not work because the GWT client does not process it.

Does anybody knows how to do this?

Thanks you. Daniel

解决方案

Window.Location.assign(newUrl)

But in general, you want to avoid doing so, because you would loose all client state. You are better off changing the view via code, and then updating History (which updates the fragment url - the portion of the url after #).

这篇关于如何从客户端重定向GWT应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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