Friday, December 16, 2016

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

Hello,

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

On Sat, Dec 17, 2016 at 12:27 AM, Vassilis Virvilis <vasvir2@gmail.com> wrote:
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





On Sat, Dec 17, 2016 at 12:22 AM, Olar Andrei <olarandrei@gmail.com> wrote:
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);
}


--
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+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+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.

--
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+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.

No comments:

Post a Comment