GWT简单的网页表单提交 - 重定向到新页面

问题描述:

我使用Google网络工具包编写了一个简单的网页表单。我希望用户在点击提交按钮时按照新的URL。但是我找不到任何将用户重定向到GWT代码中的新URL的示例。如何才能实现这一目标?

I have a simple web form written in Google web toolkit. I want the user to follow a new URL when he clicks on the submit button. However I cannot find any examples of redirecting the user to a new URL from within GWT code. How may I achieve this?

要将用户重定向到新页面,请使用 Window.Location.assign()

To redirect the user to a new page, use Window.Location.assign().

要在用户提交表单时发生这种情况,请使用 FormPanel.addSubmitHandler() addSubmitCompleteHandler() 在表单提交完成时发生重定向。

To have this happen when the user submits the form, use FormPanel.addSubmitHandler() , or addSubmitCompleteHandler() to have the redirect happen when the form submission is complete.