Is there a possiblity to display a message on the page you are redirected to?

瀏覽次數:26 次
跳到第一則未讀訊息

Olar Andrei

未讀,
2016年12月16日 下午5:22:112016/12/16
收件者:GWT Users
Hello,

I have this small example. I am on the user page. In the constructor the UserInfo object is set. If something happens I want to redirect back to the login page, which I do like in the example below. Is there a possibility to display a message back on the login page like "An error eccurred bla bla bla. Please log in again." ?

Thanks in advance.

public UserPanel() {
setUserInfo();

if (userInfo == null) {
Window.Location.replace(GWT.getHostPageBaseURL());
}

container = new MaterialContainer();
container.setFontSize("1em");

Widget mainMenu = createMenu();
initWidget(mainMenu);
}


Vassilis Virvilis

未讀,
2016年12月16日 下午5:27:272016/12/16
收件者:google-we...@googlegroups.com
You can pass a url fragment argument like
Window.Location.replace(GWT.getHostPageBaseURL() + "#error=Something bad happened");
and then in your login page you have to check for url fragments (after #).

Similarly if you don't want to pollute your urls you can
  • set a cookie
  • use sessionStorage
  • use localStorage
to communicate the error state to the new page.

Hope that helps

    Vassilis





--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsub...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

Olar Andrei

未讀,
2016年12月16日 下午6:22:302016/12/16
收件者:google-we...@googlegroups.com
Hello,

Thanks, I've done this using the cookie suggestion.

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.

To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

--
You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/3Bdp0kiOi1s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsub...@googlegroups.com.
回覆所有人
回覆作者
轉寄
0 則新訊息